Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -77,42 +77,39 @@ def respond(message, history, system_prompt, image=None):
|
|
| 77 |
with gr.Blocks(title="ESP Brain") as demo:
|
| 78 |
gr.Markdown("## ESP Brain - Настраиваемый ассистент")
|
| 79 |
|
| 80 |
-
|
| 81 |
system_prompt_input = gr.Textbox(
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
|
| 89 |
-
chatbot = gr.Chatbot(
|
|
|
|
|
|
|
| 90 |
|
| 91 |
with gr.Row():
|
| 92 |
txt = gr.Textbox(
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
type="pil",
|
| 99 |
-
label="Изображение (опционально)",
|
| 100 |
-
show_label=False,
|
| 101 |
-
scale=2
|
| 102 |
-
)
|
| 103 |
-
submit_btn = gr.Button("Отправить", scale=2)
|
| 104 |
|
| 105 |
with gr.Row():
|
| 106 |
-
|
| 107 |
undo_btn = gr.Button("↩️ Отменить")
|
| 108 |
clear_btn = gr.Button("🗑️ Очистить")
|
| 109 |
|
| 110 |
-
|
| 111 |
-
def submit_message(message, history, system_prompt
|
| 112 |
-
return respond(message, history, system_prompt
|
| 113 |
-
|
| 114 |
-
txt.submit(fn=submit_message, inputs=[txt, chatbot, system_prompt_input
|
| 115 |
-
submit_btn.click(fn=submit_message, inputs=[txt, chatbot, system_prompt_input
|
|
|
|
| 116 |
|
| 117 |
def retry_last(history, system_prompt):
|
| 118 |
if history:
|
|
|
|
| 77 |
with gr.Blocks(title="ESP Brain") as demo:
|
| 78 |
gr.Markdown("## ESP Brain - Настраиваемый ассистент")
|
| 79 |
|
| 80 |
+
# Поле для ввода системного промта
|
| 81 |
system_prompt_input = gr.Textbox(
|
| 82 |
+
label="Системный промт",
|
| 83 |
+
value=""" """,
|
| 84 |
+
lines=5,
|
| 85 |
+
max_lines=10,
|
| 86 |
+
placeholder="Введите системный промт для настройки поведения ассистента..."
|
| 87 |
+
)
|
| 88 |
|
| 89 |
+
chatbot = gr.Chatbot(
|
| 90 |
+
height=600,
|
| 91 |
+
)
|
| 92 |
|
| 93 |
with gr.Row():
|
| 94 |
txt = gr.Textbox(
|
| 95 |
+
placeholder="Напиши сообщение...",
|
| 96 |
+
show_label=False,
|
| 97 |
+
scale=8
|
| 98 |
+
)
|
| 99 |
+
submit_btn = gr.Button("Отправить", scale=2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 100 |
|
| 101 |
with gr.Row():
|
| 102 |
+
retry_btn = gr.Button("🔄 Повторить")
|
| 103 |
undo_btn = gr.Button("↩️ Отменить")
|
| 104 |
clear_btn = gr.Button("🗑️ Очистить")
|
| 105 |
|
| 106 |
+
# Логика
|
| 107 |
+
def submit_message(message, history, system_prompt):
|
| 108 |
+
return respond(message, history, system_prompt)
|
| 109 |
+
|
| 110 |
+
txt.submit(fn=submit_message, inputs=[txt, chatbot, system_prompt_input], outputs=chatbot)
|
| 111 |
+
submit_btn.click(fn=submit_message, inputs=[txt, chatbot, system_prompt_input], outputs=chatbot)
|
| 112 |
+
|
| 113 |
|
| 114 |
def retry_last(history, system_prompt):
|
| 115 |
if history:
|