Spaces:
Sleeping
Sleeping
Add application file
Browse files
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.
|
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.")
|