Ahmed007 commited on
Commit
d3c4c50
1 Parent(s): 4d81aab

Add application file

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -22,11 +22,13 @@ def analyze_image_direct(image, question):
22
  answer = model.answer_question(enc_image, question, tokenizer) # Adjust based on actual model capabilities
23
 
24
  return answer
25
- # Create a Gradio interface
26
- with gr.Blocks() as block:
27
- image = gr.Image(label="Image")
28
- question = gr.Textbox(label="Question")
29
- output = gr.Textbox(label="Answer")
30
- block.add(gr.Interface(fn=analyze_image_direct, inputs=[image, question], outputs=output))
31
 
32
- block.launch()
 
 
 
 
 
 
 
 
 
22
  answer = model.answer_question(enc_image, question, tokenizer) # Adjust based on actual model capabilities
23
 
24
  return answer
 
 
 
 
 
 
25
 
26
+ # Create Gradio interface
27
+ iface = gr.Interface(fn=analyze_image_direct,
28
+ inputs=[gr.Image(type="pil"), gr.Textbox(lines=2, placeholder="Enter your question here...")],
29
+ outputs='text',
30
+ title="Direct Image Question Answering",
31
+ description="Upload an image and ask a question about it directly using the model.")
32
+
33
+ # Launch the interface
34
+ iface.launch()