Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -185,11 +185,18 @@ def vote(chatbot, data: gr.LikeData):
|
|
| 185 |
)
|
| 186 |
|
| 187 |
# Create Gradio interface
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
with gr.Blocks(js=on_load) as demo:
|
| 190 |
chatbot = gr.Chatbot(label="Chatbot", likeable=True, render=False)
|
| 191 |
chatbot.like(vote, [chatbot], None)
|
| 192 |
-
gr.ChatInterface(
|
| 193 |
predict,
|
| 194 |
chatbot=chatbot,
|
| 195 |
title=EMOJI + " " + MODEL_NAME,
|
|
@@ -210,6 +217,7 @@ with gr.Blocks(js=on_load) as demo:
|
|
| 210 |
],
|
| 211 |
theme=gr.themes.Soft(primary_hue=COLOR),
|
| 212 |
)
|
|
|
|
| 213 |
|
| 214 |
demo.queue(max_size=20).launch()
|
| 215 |
|
|
|
|
| 185 |
)
|
| 186 |
|
| 187 |
# Create Gradio interface
|
| 188 |
+
def update_examples():
|
| 189 |
+
return gr.Dataset(samples=random.choice(
|
| 190 |
+
[
|
| 191 |
+
[["merhaba"], ["merhaba2"]],
|
| 192 |
+
[["bonjour"], ["bonjour2"]]
|
| 193 |
+
]
|
| 194 |
+
))
|
| 195 |
+
|
| 196 |
with gr.Blocks(js=on_load) as demo:
|
| 197 |
chatbot = gr.Chatbot(label="Chatbot", likeable=True, render=False)
|
| 198 |
chatbot.like(vote, [chatbot], None)
|
| 199 |
+
chat = gr.ChatInterface(
|
| 200 |
predict,
|
| 201 |
chatbot=chatbot,
|
| 202 |
title=EMOJI + " " + MODEL_NAME,
|
|
|
|
| 217 |
],
|
| 218 |
theme=gr.themes.Soft(primary_hue=COLOR),
|
| 219 |
)
|
| 220 |
+
demo.load(update_examples, None, chat.examples_handler.dataset)
|
| 221 |
|
| 222 |
demo.queue(max_size=20).launch()
|
| 223 |
|