Simba commited on
Commit
73cfc8e
1 Parent(s): b4a3e90
Files changed (1) hide show
  1. app.py +32 -19
app.py CHANGED
@@ -40,25 +40,38 @@ def respond(image: np.ndarray, prompt: str, chat_history=None):
40
  return "", chat_history
41
 
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  with gr.Blocks() as demo:
44
  gr.Markdown(MARKDOWN)
45
  with gr.Row():
46
- webcam = gr.Image(sources=["webcam"], streaming=True, type="numpy")
47
- message = gr.Textbox()
48
- chatbot = gr.Chatbot()
49
- clear_button = gr.Button("Clear")
50
- submit_button = gr.Button("Submit")
51
-
52
- submit_button.click(
53
- fn=respond,
54
- inputs=[webcam, message],
55
- outputs=[chatbot]
56
- )
57
-
58
- clear_button.click(
59
- fn=lambda: ("", []),
60
- inputs=[],
61
- outputs=[message, chatbot]
62
- )
63
-
64
- demo.launch(debug=True, show_error=True)
 
40
  return "", chat_history
41
 
42
 
43
+ # with gr.Blocks() as demo:
44
+ # gr.Markdown(MARKDOWN)
45
+ # with gr.Row():
46
+ # webcam = gr.Image(sources=["webcam"], streaming=True, type="numpy")
47
+ # message = gr.Textbox()
48
+ # chatbot = gr.Chatbot()
49
+ # clear_button = gr.Button("Clear")
50
+ # submit_button = gr.Button("Submit")
51
+
52
+ # submit_button.click(
53
+ # fn=respond,
54
+ # inputs=[webcam, message],
55
+ # outputs=[chatbot]
56
+ # )
57
+
58
+ # clear_button.click(
59
+ # fn=lambda: ("", []),
60
+ # inputs=[],
61
+ # outputs=[message, chatbot]
62
+ # )
63
+
64
+ # demo.launch(debug=True, show_error=True)
65
+
66
  with gr.Blocks() as demo:
67
  gr.Markdown(MARKDOWN)
68
  with gr.Row():
69
+ webcam = gr.Image(sources=["webcam"], streaming=True)
70
+ with gr.Column():
71
+ chatbot = gr.Chatbot(height=500)
72
+ message = gr.Textbox()
73
+ clear_button = gr.ClearButton([message, chatbot])
74
+
75
+ message.submit(respond, [webcam, message, chatbot], [message, chatbot])
76
+
77
+ demo.launch(debug=False, show_error=True)