Spaces:
Sleeping
Sleeping
File size: 656 Bytes
6e0e2bc b6454cf 6e0e2bc b6454cf 6e0e2bc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
import requests
def send_to_fastapi(image, question):
url = 'http://127.0.0.1:8000/analyze-image/'
files = {'file': ('image.png', image, 'image/png')}
data = {'question': question}
response = requests.post(url, files=files, data=data)
return response.json()['answer']
iface = gr.Interface(fn=send_to_fastapi,
inputs=[gr.Image(type='file'), gr.Textbox(lines=2, placeholder="Enter your question here...")],
outputs='text',
title="Image Question Answering",
description="Upload an image and ask a question about it.")
iface.launch() |