style: ui
Browse files
app.py
CHANGED
@@ -192,8 +192,17 @@ def _spinner_markup(running: bool) -> str:
|
|
192 |
async def gradio_run(query: str, ui_state: Optional[dict]):
|
193 |
query = replace_chinese_punctuation(query or "")
|
194 |
if contains_chinese(query):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
195 |
yield (
|
196 |
-
|
197 |
gr.update(interactive=True),
|
198 |
gr.update(interactive=False),
|
199 |
ui_state or {"chat_id": None}
|
@@ -232,9 +241,18 @@ async def gradio_run(query: str, ui_state: Optional[dict]):
|
|
232 |
ui_state
|
233 |
)
|
234 |
except asyncio.CancelledError:
|
235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
236 |
yield (
|
237 |
-
|
238 |
gr.update(interactive=True),
|
239 |
gr.update(interactive=False),
|
240 |
ui_state
|
@@ -280,15 +298,24 @@ def build_demo():
|
|
280 |
custom_css = """
|
281 |
#log-view { border: 1px solid #ececec; padding: 12px; border-radius: 8px; scroll-behavior: smooth; }
|
282 |
"""
|
283 |
-
with gr.Blocks(css=custom_css) as demo:
|
284 |
-
gr.
|
285 |
-
|
286 |
-
|
287 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
with gr.Row():
|
289 |
inp = gr.Textbox(lines=3, label="Question (English only)")
|
290 |
with gr.Row():
|
291 |
-
run_btn = gr.Button("
|
292 |
stop_btn = gr.Button("Stop", variant="stop", interactive=False)
|
293 |
out_md = gr.Markdown("", elem_id="log-view")
|
294 |
ui_state = gr.State({"chat_id": None})
|
|
|
192 |
async def gradio_run(query: str, ui_state: Optional[dict]):
|
193 |
query = replace_chinese_punctuation(query or "")
|
194 |
if contains_chinese(query):
|
195 |
+
warning_html = (
|
196 |
+
"<div style='background: #f8f9fa; border-left: 4px solid #ffc107; "
|
197 |
+
"color: #495057; padding: 16px; border-radius: 6px; margin: 15px 0; "
|
198 |
+
"font-size: 14px;'>"
|
199 |
+
"<div style='font-weight: 600; margin-bottom: 4px;'>💡 Notice</div>"
|
200 |
+
"<div>We only support English input for the time being. "
|
201 |
+
"Please translate your question to English and try again.</div>"
|
202 |
+
"</div>"
|
203 |
+
)
|
204 |
yield (
|
205 |
+
warning_html,
|
206 |
gr.update(interactive=True),
|
207 |
gr.update(interactive=False),
|
208 |
ui_state or {"chat_id": None}
|
|
|
241 |
ui_state
|
242 |
)
|
243 |
except asyncio.CancelledError:
|
244 |
+
cancelled_html = (
|
245 |
+
"<div style='background: #f8f9fa; border-left: 4px solid #17a2b8; "
|
246 |
+
"color: #495057; padding: 16px; border-radius: 6px; margin: 15px 0; "
|
247 |
+
"font-size: 14px;'>"
|
248 |
+
"<div style='font-weight: 600; margin-bottom: 4px;'>🛑 Task Cancelled</div>"
|
249 |
+
"<div>The current task has been cancelled successfully.</div>"
|
250 |
+
"</div>"
|
251 |
+
)
|
252 |
+
existing_content = _render_markdown(state)
|
253 |
+
final_content = cancelled_html + existing_content if existing_content and existing_content != "Waiting..." else cancelled_html
|
254 |
yield (
|
255 |
+
final_content,
|
256 |
gr.update(interactive=True),
|
257 |
gr.update(interactive=False),
|
258 |
ui_state
|
|
|
298 |
custom_css = """
|
299 |
#log-view { border: 1px solid #ececec; padding: 12px; border-radius: 8px; scroll-behavior: smooth; }
|
300 |
"""
|
301 |
+
with gr.Blocks(css=custom_css, title="MiroThinker Demo") as demo:
|
302 |
+
gr.HTML(
|
303 |
+
"<div style='text-align:center;font-size:32px;font-weight:bold;margin-bottom:10px;'>MiroThinker Demo</div>"
|
304 |
+
"<div style='text-align:center;color:#666;font-size:16px;margin-bottom:15px;'>"
|
305 |
+
"High performance in deep research and tool use.<br>"
|
306 |
+
"Couple with framework: <a href='https://github.com/MiroMindAI/MiroThinker' target='_blank'>https://github.com/MiroMindAI/MiroThinker</a></div>"
|
307 |
+
"<div style='text-align:center;margin-bottom:20px;'>"
|
308 |
+
"<a href='https://huggingface.co/miromind-ai/MiroThinker-32B-DPO-v0.1' target='_blank'>Model</a> | "
|
309 |
+
"<a href='https://dr.miromind.ai' target='_blank'>Full Featured Website</a> | "
|
310 |
+
"<a href='https://miromind.ai/blog/miromind-open-deep-research' target='_blank'>Blog</a> | "
|
311 |
+
"<a href='https://huggingface.co/datasets/miromind-ai/MiroVerse-v0.1' target='_blank'>Data</a></div>"
|
312 |
+
"<div style='text-align:center;color:#888;font-size:14px;margin-bottom:20px;'>"
|
313 |
+
"Enter an English question and observe Agents and tool calls in real time.</div>"
|
314 |
+
)
|
315 |
with gr.Row():
|
316 |
inp = gr.Textbox(lines=3, label="Question (English only)")
|
317 |
with gr.Row():
|
318 |
+
run_btn = gr.Button("Send")
|
319 |
stop_btn = gr.Button("Stop", variant="stop", interactive=False)
|
320 |
out_md = gr.Markdown("", elem_id="log-view")
|
321 |
ui_state = gr.State({"chat_id": None})
|