FrostIce commited on
Commit
f043858
·
verified ·
1 Parent(s): 9fe83f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -26
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
- label="Системный промт",
83
- value=""" """,
84
- lines=5,
85
- max_lines=10,
86
- placeholder="Введите системный промт для настройки поведения ассистента..."
87
- )
88
 
89
- chatbot = gr.Chatbot(height=600)
 
 
90
 
91
  with gr.Row():
92
  txt = gr.Textbox(
93
- placeholder="Напиши сообщение...",
94
- show_label=False,
95
- scale=6
96
- )
97
- img = gr.Image(
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
- retry_btn = gr.Button("🔄 Повторить")
107
  undo_btn = gr.Button("↩️ Отменить")
108
  clear_btn = gr.Button("🗑️ Очистить")
109
 
110
- # Логика
111
- def submit_message(message, history, system_prompt, image):
112
- return respond(message, history, system_prompt, image)
113
-
114
- txt.submit(fn=submit_message, inputs=[txt, chatbot, system_prompt_input, img], outputs=chatbot)
115
- submit_btn.click(fn=submit_message, inputs=[txt, chatbot, system_prompt_input, img], outputs=chatbot)
 
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: