Spaces:
Sleeping
Sleeping
File size: 746 Bytes
6e0e2bc 40df25a 6e0e2bc 40df25a 6e0e2bc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
import requests
def send_to_fastapi(image, question):
url = 'https://ahmed007-modarb-api.hf.space/analyze-image/'
# Convert the image to bytes for the request
image_bytes = image.read()
files = {'file': ('image.png', image_bytes, '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(), 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() |