Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from response_db import StResponseDb | |
| ID = "1234" | |
| turn = int(0) | |
| db = StResponseDb() | |
| question = "What color is the cat?" | |
| img_url = 'https://upload.wikimedia.org/wikipedia/commons/thumb/6/68/Orange_tabby_cat_sitting_on_fallen_leaves-Hisashi-01A.jpg/1920px-Orange_tabby_cat_sitting_on_fallen_leaves-Hisashi-01A.jpg', | |
| def add_response(response): | |
| db.add(ID, turn, question, response) | |
| return str(db.get_all()) | |
| with gr.Blocks() as demo: | |
| #gr.Image(value=img_url, shape=(400,None)) | |
| gr.Textbox(label="Question", value=question) | |
| #image = gr.Image(value=img_url) | |
| response = gr.Textbox(label="Response") | |
| submit = gr.Button("Submit") | |
| db_contents = gr.Textbox(label="output") | |
| submit.click(fn=add_response, inputs=response, outputs=db_contents) | |
| demo.launch(share=True) |