Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import base64
|
| 2 |
import os
|
| 3 |
import uuid
|
| 4 |
-
|
| 5 |
import cv2
|
| 6 |
import gradio as gr
|
| 7 |
import numpy as np
|
|
@@ -98,17 +98,17 @@ def respond(api_key: str, image: np.ndarray, prompt: str, chat_history):
|
|
| 98 |
return "", chat_history
|
| 99 |
|
| 100 |
|
| 101 |
-
with gr.Blocks() as demo:
|
| 102 |
gr.Markdown(MARKDOWN)
|
| 103 |
with gr.Row():
|
| 104 |
-
webcam = gr.
|
| 105 |
with gr.Column():
|
| 106 |
api_key_textbox = gr.Textbox(
|
| 107 |
label="OpenAI API KEY", type="password")
|
| 108 |
chatbot = gr.Chatbot(
|
| 109 |
height=500, bubble_full_width=False, avatar_images=AVATARS)
|
| 110 |
message_textbox = gr.Textbox()
|
| 111 |
-
clear_button = gr.ClearButton([message_textbox, chatbot])
|
| 112 |
|
| 113 |
message_textbox.submit(
|
| 114 |
fn=respond,
|
|
|
|
| 1 |
import base64
|
| 2 |
import os
|
| 3 |
import uuid
|
| 4 |
+
import time
|
| 5 |
import cv2
|
| 6 |
import gradio as gr
|
| 7 |
import numpy as np
|
|
|
|
| 98 |
return "", chat_history
|
| 99 |
|
| 100 |
|
| 101 |
+
with gr.Blocks(theme=gr.themes.Default(primary_hue="pink", secondary_hue="pink")) as demo:
|
| 102 |
gr.Markdown(MARKDOWN)
|
| 103 |
with gr.Row():
|
| 104 |
+
webcam = gr.Webcam(source="webcam", streaming=True)
|
| 105 |
with gr.Column():
|
| 106 |
api_key_textbox = gr.Textbox(
|
| 107 |
label="OpenAI API KEY", type="password")
|
| 108 |
chatbot = gr.Chatbot(
|
| 109 |
height=500, bubble_full_width=False, avatar_images=AVATARS)
|
| 110 |
message_textbox = gr.Textbox()
|
| 111 |
+
clear_button = gr.ClearButton([message_textbox, chatbot, variant="primary"])
|
| 112 |
|
| 113 |
message_textbox.submit(
|
| 114 |
fn=respond,
|