Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -131,7 +131,7 @@ def respond(message, language, system_message, max_tokens, temperature, top_p):
|
|
| 131 |
with gr.Blocks() as demo:
|
| 132 |
gr.Markdown("# Chatbot con Verificaci贸n de Pol铆ticas")
|
| 133 |
language = gr.Dropdown(choices=["English", "Espa帽ol"], value="English", label="Idioma/Language")
|
| 134 |
-
system_message =
|
| 135 |
|
| 136 |
with gr.Accordion("Avanzado", open=False):
|
| 137 |
max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens")
|
|
@@ -142,21 +142,23 @@ with gr.Blocks() as demo:
|
|
| 142 |
message = gr.Textbox(label="Your message")
|
| 143 |
submit_button = gr.Button("Send")
|
| 144 |
|
| 145 |
-
def submit_message(user_message, chat_history,
|
| 146 |
chat_history = chat_history + [[user_message, None]]
|
| 147 |
assistant_reply = respond(user_message, language, system_message, max_tokens, temperature, top_p)
|
| 148 |
chat_history[-1][1] = assistant_reply
|
| 149 |
return "", chat_history
|
| 150 |
|
|
|
|
| 151 |
submit_button.click(
|
| 152 |
submit_message,
|
| 153 |
-
inputs=[message, chatbot,
|
| 154 |
outputs=[message, chatbot],
|
| 155 |
)
|
| 156 |
message.submit(
|
| 157 |
submit_message,
|
| 158 |
-
inputs=[message, chatbot,
|
| 159 |
outputs=[message, chatbot],
|
| 160 |
)
|
| 161 |
|
|
|
|
| 162 |
demo.launch(debug=True)
|
|
|
|
| 131 |
with gr.Blocks() as demo:
|
| 132 |
gr.Markdown("# Chatbot con Verificaci贸n de Pol铆ticas")
|
| 133 |
language = gr.Dropdown(choices=["English", "Espa帽ol"], value="English", label="Idioma/Language")
|
| 134 |
+
system_message = "You are a friendly Chatbot."
|
| 135 |
|
| 136 |
with gr.Accordion("Avanzado", open=False):
|
| 137 |
max_tokens = gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens")
|
|
|
|
| 142 |
message = gr.Textbox(label="Your message")
|
| 143 |
submit_button = gr.Button("Send")
|
| 144 |
|
| 145 |
+
def submit_message(user_message, chat_history, max_tokens, temperature, top_p, language):
|
| 146 |
chat_history = chat_history + [[user_message, None]]
|
| 147 |
assistant_reply = respond(user_message, language, system_message, max_tokens, temperature, top_p)
|
| 148 |
chat_history[-1][1] = assistant_reply
|
| 149 |
return "", chat_history
|
| 150 |
|
| 151 |
+
|
| 152 |
submit_button.click(
|
| 153 |
submit_message,
|
| 154 |
+
inputs=[message, chatbot, max_tokens, temperature, top_p, language],
|
| 155 |
outputs=[message, chatbot],
|
| 156 |
)
|
| 157 |
message.submit(
|
| 158 |
submit_message,
|
| 159 |
+
inputs=[message, chatbot, max_tokens, temperature, top_p, language],
|
| 160 |
outputs=[message, chatbot],
|
| 161 |
)
|
| 162 |
|
| 163 |
+
|
| 164 |
demo.launch(debug=True)
|