Ahmed007 commited on
Commit
b6454cf
·
1 Parent(s): 6e0e2bc

Add application file

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -3,13 +3,13 @@ import requests
3
 
4
  def send_to_fastapi(image, question):
5
  url = 'http://127.0.0.1:8000/analyze-image/'
6
- files = {'file': image}
7
  data = {'question': question}
8
  response = requests.post(url, files=files, data=data)
9
  return response.json()['answer']
10
 
11
  iface = gr.Interface(fn=send_to_fastapi,
12
- inputs=[gr.inputs.Image(type='file'), gr.inputs.Textbox(lines=2, placeholder="Enter your question here...")],
13
  outputs='text',
14
  title="Image Question Answering",
15
  description="Upload an image and ask a question about it.")
 
3
 
4
  def send_to_fastapi(image, question):
5
  url = 'http://127.0.0.1:8000/analyze-image/'
6
+ files = {'file': ('image.png', image, 'image/png')}
7
  data = {'question': question}
8
  response = requests.post(url, files=files, data=data)
9
  return response.json()['answer']
10
 
11
  iface = gr.Interface(fn=send_to_fastapi,
12
+ inputs=[gr.Image(type='file'), gr.Textbox(lines=2, placeholder="Enter your question here...")],
13
  outputs='text',
14
  title="Image Question Answering",
15
  description="Upload an image and ask a question about it.")