Spaces:
Runtime error
Runtime error
| #app.py | |
| import gradio as gr | |
| from gradio_client import Client | |
| client = Client("https://adept-fuyu-8b-demo.hf.space/--replicas/9kcqv/") | |
| filepath = "https://raw.githubusercontent.com/gradio-app/gradio/main/test/test_files/bus.png" | |
| question = "what color is the bus?" | |
| def vqa(image:str, prompt:str): | |
| result = client.predict(image,prompt,fn_index=3) | |
| print(result) | |
| print(result.lstrip()) | |
| return result | |
| css = """ | |
| #mkd { | |
| height: 500px; | |
| overflow: auto; | |
| border: 1px solid #ccc; | |
| } | |
| """ | |
| with gr.Blocks(css=css) as demo: | |
| with gr.Row(): | |
| with gr.Column(): | |
| image_input = gr.Image(label="Upload your Image", type="pil") | |
| text_input = gr.Textbox(label="Ask a Question") | |
| vqa_output = gr.Textbox(label="Output") | |
| vqa_btn = gr.Button("Answer Visual Question") | |
| vqa_btn.click( | |
| fn=vqa, | |
| inputs = [image_input,text_input], | |
| outputs = vqa_output | |
| ) | |
| demo.launch() |