Update app.py
Browse files
app.py
CHANGED
@@ -5,10 +5,6 @@ import json
|
|
5 |
import time
|
6 |
from load_llms import model_choices, llm_intro, load_model
|
7 |
|
8 |
-
def clear_output(message, chatbot):
|
9 |
-
message.update(value="")
|
10 |
-
chatbot.update(value="")
|
11 |
-
|
12 |
|
13 |
# Construct chatbot
|
14 |
def generate_response(model_name, message, chat_history):
|
@@ -24,7 +20,7 @@ with gr.Blocks(
|
|
24 |
"#chatbot { flex-grow: 1 !important; overflow: auto !important; }"
|
25 |
"#col { height: calc(100vh - 112px - 16px) !important; }"
|
26 |
"#submit:hover { background-color: green !important; }"
|
27 |
-
"#clear
|
28 |
theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Martel Sans")])
|
29 |
) as demo:
|
30 |
gr.Markdown("# GPT4All Chatbot")
|
@@ -51,9 +47,7 @@ with gr.Blocks(
|
|
51 |
submit_button = gr.Button("Submit", scale=1, elem_id="submit")
|
52 |
submit_button.click(generate_response, inputs=[model_dropdown, message, chatbot], outputs=[message, chatbot])
|
53 |
|
54 |
-
|
55 |
-
clear_button = gr.Button("Clear", elem_id="clear")
|
56 |
-
clear_button.click(clear_output, inputs=[message, chatbot], outputs=[message, chatbot])
|
57 |
|
58 |
# Launch the Gradio app
|
59 |
demo.launch()
|
|
|
5 |
import time
|
6 |
from load_llms import model_choices, llm_intro, load_model
|
7 |
|
|
|
|
|
|
|
|
|
8 |
|
9 |
# Construct chatbot
|
10 |
def generate_response(model_name, message, chat_history):
|
|
|
20 |
"#chatbot { flex-grow: 1 !important; overflow: auto !important; }"
|
21 |
"#col { height: calc(100vh - 112px - 16px) !important; }"
|
22 |
"#submit:hover { background-color: green !important; }"
|
23 |
+
"#clear { background-color: #CD1818 !important; }",
|
24 |
theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Martel Sans")])
|
25 |
) as demo:
|
26 |
gr.Markdown("# GPT4All Chatbot")
|
|
|
47 |
submit_button = gr.Button("Submit", scale=1, elem_id="submit")
|
48 |
submit_button.click(generate_response, inputs=[model_dropdown, message, chatbot], outputs=[message, chatbot])
|
49 |
|
50 |
+
clear = gr.ClearButton([message, chatbot], elem_id="clear")
|
|
|
|
|
51 |
|
52 |
# Launch the Gradio app
|
53 |
demo.launch()
|