Shape changes
Browse files
app.py
CHANGED
|
@@ -127,18 +127,39 @@ def chat_fn(message: str, ui_history: list, messages_state: List[Dict[str, str]]
|
|
| 127 |
print("STATE:", json.dumps(final_state, ensure_ascii=False))
|
| 128 |
|
| 129 |
|
| 130 |
-
with gr.Blocks(
|
| 131 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
messages_state = gr.State([{"role": "system", "content": SYS_PROMPT_TT}])
|
| 134 |
|
| 135 |
-
chatbot = gr.Chatbot(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
msg = gr.Textbox(
|
| 137 |
label="Хәбәрегезне рус яки татар телендә языгыз",
|
| 138 |
-
placeholder="Татарстанның башкаласы нинди шәһәр? / Какая столица Татарстана?"
|
|
|
|
| 139 |
)
|
| 140 |
-
clear = gr.Button("🗑️ Чистарту")
|
| 141 |
|
|
|
|
|
|
|
| 142 |
msg.submit(
|
| 143 |
chat_fn,
|
| 144 |
inputs=[msg, chatbot, messages_state],
|
|
|
|
| 127 |
print("STATE:", json.dumps(final_state, ensure_ascii=False))
|
| 128 |
|
| 129 |
|
| 130 |
+
with gr.Blocks(
|
| 131 |
+
theme=gr.themes.Soft(),
|
| 132 |
+
css="""
|
| 133 |
+
#chatbot .gr-chatbot { font-size: 18px !important; line-height: 1.5; }
|
| 134 |
+
#chatbot .gr-chatbot_message { font-size: 18px !important; }
|
| 135 |
+
#chatbot .gr-chatbot_markdown > * { font-size: 18px !important; line-height: 1.6; }
|
| 136 |
+
|
| 137 |
+
#msg textarea { font-size: 24px !important; }
|
| 138 |
+
|
| 139 |
+
#clear { font-size: 16px !important; }
|
| 140 |
+
|
| 141 |
+
#title h2 { font-size: 28px !important; }
|
| 142 |
+
"""
|
| 143 |
+
) as demo:
|
| 144 |
+
gr.Markdown("## Татарский чат-бот от команды Сбера", elem_id="title")
|
| 145 |
|
| 146 |
messages_state = gr.State([{"role": "system", "content": SYS_PROMPT_TT}])
|
| 147 |
|
| 148 |
+
chatbot = gr.Chatbot(
|
| 149 |
+
label="Диалог",
|
| 150 |
+
height=500,
|
| 151 |
+
bubble_full_width=False,
|
| 152 |
+
elem_id="chatbot"
|
| 153 |
+
)
|
| 154 |
+
|
| 155 |
msg = gr.Textbox(
|
| 156 |
label="Хәбәрегезне рус яки татар телендә языгыз",
|
| 157 |
+
placeholder="Татарстанның башкаласы нинди шәһәр? / Какая столица Татарстана?",
|
| 158 |
+
elem_id="msg"
|
| 159 |
)
|
|
|
|
| 160 |
|
| 161 |
+
clear = gr.Button("🗑️ Чистарту", elem_id="clear")
|
| 162 |
+
|
| 163 |
msg.submit(
|
| 164 |
chat_fn,
|
| 165 |
inputs=[msg, chatbot, messages_state],
|