Spaces:
Runtime error
Runtime error
Update app.py
Browse files12 unmodified lines1314151617181920212223242526272829303132333435363738394041424344454637 unmodified lines84858687888912 unmodified lines# Initialize chatbot historymessages = []# UI setupwith gr.Blocks() as demo:chatbot = gr.Chatbot([],elem_id="chatbot",bubble_full_width=False,avatar_images=(None, None), # You can specify avatar images if needed)with gr.Row():txt = gr.Textbox(scale=4,show_label=False,placeholder="Enter text and press enter, or upload an image",container=False,)btn = gr.UploadButton("📁", file_types=["image", "video", "audio"])txt_msg = txt.submit(add_content, [chatbot, txt], [chatbot, txt], queue=False).then(run, [chatbot, txt, None, None, None], [chatbot, txt, None, None, None], api_name="bot_response")txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)file_msg = btn.upload(add_content, [chatbot, None, None, btn, None], [chatbot, None, None, None], queue=False).then(run, [chatbot, None, None, None, btn], [chatbot, None, None, None, None])chatbot.like(print_like_dislike, None, None)# Function to add content to chatbotdef add_content(chatbot, text, image, audio_upload, audio_mic) -> gr.Chatbot:textflag, imageflag, audioflag = False, False, False37 unmodified lineshistory.append((None, outputs.title()))return history, None, None, None, None# Launch the Gradio UIdemo.queue()12 unmodified lines13141516171837 unmodified lines56575859606162636465666768697071727374757677787980818283848586878889909112 unmodified lines# Initialize chatbot historymessages = []# Function to add content to chatbotdef add_content(chatbot, text, image, audio_upload, audio_mic) -> gr.Chatbot:textflag, imageflag, audioflag = False, False, False37 unmodified lineshistory.append((None, outputs.title()))return history, None, None, None, None# UI setupwith gr.Blocks() as demo:chatbot = gr.Chatbot([],elem_id="chatbot",bubble_full_width=False,avatar_images=(None, None), # You can specify avatar images if needed)with gr.Row():txt = gr.Textbox(scale=4,show_label=False,placeholder="Enter text and press enter, or upload an image",container=False,)btn = gr.UploadButton("📁", file_types=["image", "video", "audio"])txt_msg = txt.submit(add_content, [chatbot, txt], [chatbot, txt], queue=False).then(run, [chatbot, txt, None, None, None], [chatbot, txt, None, None, None], api_name="bot_response")txt_msg.then(lambda: gr.Textbox(interactive=True), None, [txt], queue=False)file_msg = btn.upload(add_content, [chatbot, None, None, btn, None], [chatbot, None, None, None], queue=False).then(run, [chatbot, None, None, None, btn], [chatbot, None, None, None, None])chatbot.like(print_like_dislike, None, None)# Launch the Gradio UIdemo.queue()
app.py+30-28