Simba commited on
Commit
c1ccc26
1 Parent(s): a7a04f0
Files changed (1) hide show
  1. app.py +5 -11
app.py CHANGED
@@ -36,25 +36,19 @@ def respond(image: np.ndarray, prompt: str, chat_history):
36
  return "", chat_history
37
 
38
 
39
- # Define the function that will process the inputs
40
- def process(inputs):
41
- image, prompt, chat_history = inputs
42
- return respond(image, prompt, chat_history)
43
-
44
-
45
  with gr.Blocks() as demo:
46
  gr.Markdown(MARKDOWN)
47
  with gr.Row():
48
- webcam = gr.Image(source="webcam", tool="select", type="numpy", streaming=True) # Correct component for webcam
49
  message = gr.Textbox()
50
  chatbot = gr.Chatbot()
51
  clear_button = gr.Button("Clear")
52
  submit_button = gr.Button("Submit")
53
 
54
  submit_button.click(
55
- fn=process,
56
- inputs=[webcam, message, chatbot.chat_history],
57
- outputs=[message, chatbot]
58
  )
59
 
60
  clear_button.click(
@@ -63,4 +57,4 @@ with gr.Blocks() as demo:
63
  outputs=[message, chatbot]
64
  )
65
 
66
- demo.launch(debug=False, show_error=True)
 
36
  return "", chat_history
37
 
38
 
 
 
 
 
 
 
39
  with gr.Blocks() as demo:
40
  gr.Markdown(MARKDOWN)
41
  with gr.Row():
42
+ webcam = gr.Image(sources=["webcam"], streaming=True, tool="select", type="numpy")
43
  message = gr.Textbox()
44
  chatbot = gr.Chatbot()
45
  clear_button = gr.Button("Clear")
46
  submit_button = gr.Button("Submit")
47
 
48
  submit_button.click(
49
+ fn=respond,
50
+ inputs=[webcam, message],
51
+ outputs=[chatbot]
52
  )
53
 
54
  clear_button.click(
 
57
  outputs=[message, chatbot]
58
  )
59
 
60
+ demo.launch(debug=True, show_error=True)