Spaces:
Running
on
Zero
Running
on
Zero
adds interface
Browse files
app.py
CHANGED
|
@@ -34,6 +34,28 @@ print(f" Model Name: {MODEL_NAME}")
|
|
| 34 |
print(f" Model Subfolder: {MODEL_SUBFOLDER}")
|
| 35 |
print(f" Use LoRA: {USE_LORA}")
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
# ----------------------------------------------------------------------
|
| 38 |
# KaTeX delimiter config for Gradio
|
| 39 |
# ----------------------------------------------------------------------
|
|
@@ -236,30 +258,6 @@ def generate_response(input_data, chat_history, max_new_tokens, model_identity,
|
|
| 236 |
logging.exception("Generation streaming failed")
|
| 237 |
yield f"❌ Error during generation: {e}"
|
| 238 |
|
| 239 |
-
|
| 240 |
-
TITLE_MD = f"# 🙋🏻♂️Welcome to 🌟Tonic's ⚕️{MODEL_NAME} Demo !"
|
| 241 |
-
|
| 242 |
-
DESCRIPTION_MD = f"""
|
| 243 |
-
**Model**: `{LORA_MODEL_ID}`
|
| 244 |
-
**Base**: `{BASE_MODEL_ID}`
|
| 245 |
-
|
| 246 |
-
✨ **Enhanced Features:**
|
| 247 |
-
- 🧠 **Advanced Reasoning**: Detailed analysis and step-by-step thinking
|
| 248 |
-
- 📊 **LaTeX Support**: Mathematical formulas rendered beautifully (use `$` or `$$`)
|
| 249 |
-
- 🎯 **Improved Formatting**: Clear separation of reasoning and final responses
|
| 250 |
-
- 📝 **Smart Logging**: Better error handling and request tracking
|
| 251 |
-
|
| 252 |
-
💡 **Usage Tips:**
|
| 253 |
-
- Adjust reasoning level in system prompt (e.g., "Reasoning: high")
|
| 254 |
-
- Use LaTeX for math: `$E = mc^2$` or `$$\\int x^2 dx$$`
|
| 255 |
-
- Wait a couple of seconds initially for model loading
|
| 256 |
-
"""
|
| 257 |
-
|
| 258 |
-
JOIN_US_MD = """
|
| 259 |
-
## Join us :
|
| 260 |
-
🌟TeamTonic🌟 is always making cool demos! Join our active builder's 🛠️community 👻 [](https://discord.gg/qdfnvSPcqP) On 🤗Huggingface:[MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to🌟 [MultiTonic](https://github.com/MultiTonic)🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
|
| 261 |
-
"""
|
| 262 |
-
|
| 263 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 264 |
gr.Markdown(TITLE_MD)
|
| 265 |
with gr.Row():
|
|
@@ -296,6 +294,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 296 |
value=DEFAULT_REASONING_EFFORT,
|
| 297 |
interactive=True,
|
| 298 |
),
|
|
|
|
| 299 |
examples=[
|
| 300 |
[{"text": "A 68-year-old man complains of several blisters arising over the back and trunk for the preceding 2 weeks. He takes no medications and has not noted systemic symptoms such as fever, sore throat, weight loss, or fatigue. The general physical examination is normal. The oral mucosa and the lips are normal. Several 2- to 3-cm bullae are present over the trunk and back. A few excoriations where the blisters have ruptured are present. The remainder of the skin is normal, without erythema or scale. What is the best diagnostic approach at this time?"}],
|
| 301 |
[{"text": "A 28-year-old woman, gravida 2, para 1, at 40 weeks of gestation is admitted to the hospital in active labor. The patient has attended many prenatal appointments and followed her physician's advice about screening for diseases, laboratory testing, diet, and exercise. Her pregnancy has been uncomplicated. She has no history of a serious illness. Her first child was delivered via normal vaginal delivery. Her vital signs are within normal limits. Cervical examination shows 100% effacement and 10 cm dilation. A cardiotocograph is shown. Which of the following is the most appropriate initial step in management?"}],
|
|
|
|
| 34 |
print(f" Model Subfolder: {MODEL_SUBFOLDER}")
|
| 35 |
print(f" Use LoRA: {USE_LORA}")
|
| 36 |
|
| 37 |
+
TITLE_MD = f"# 🙋🏻♂️Welcome to 🌟Tonic's ⚕️{MODEL_NAME} Demo !"
|
| 38 |
+
|
| 39 |
+
DESCRIPTION_MD = f"""
|
| 40 |
+
**Model**: `{LORA_MODEL_ID}`
|
| 41 |
+
**Base**: `{BASE_MODEL_ID}`
|
| 42 |
+
|
| 43 |
+
✨ **Enhanced Features:**
|
| 44 |
+
- 🧠 **Advanced Reasoning**: Detailed analysis and step-by-step thinking
|
| 45 |
+
- 📊 **LaTeX Support**: Mathematical formulas rendered beautifully (use `$` or `$$`)
|
| 46 |
+
- 🎯 **Improved Formatting**: Clear separation of reasoning and final responses
|
| 47 |
+
- 📝 **Smart Logging**: Better error handling and request tracking
|
| 48 |
+
|
| 49 |
+
💡 **Usage Tips:**
|
| 50 |
+
- Adjust reasoning level in system prompt (e.g., "Reasoning: high")
|
| 51 |
+
- Use LaTeX for math: `$E = mc^2$` or `$$\\int x^2 dx$$`
|
| 52 |
+
- Wait a couple of seconds initially for model loading
|
| 53 |
+
"""
|
| 54 |
+
|
| 55 |
+
JOIN_US_MD = """
|
| 56 |
+
## Join us :
|
| 57 |
+
🌟TeamTonic🌟 is always making cool demos! Join our active builder's 🛠️community 👻 [](https://discord.gg/qdfnvSPcqP) On 🤗Huggingface:[MultiTransformer](https://huggingface.co/MultiTransformer) On 🌐Github: [Tonic-AI](https://github.com/tonic-ai) & contribute to🌟 [MultiTonic](https://github.com/MultiTonic)🤗Big thanks to Yuvi Sharma and all the folks at huggingface for the community grant 🤗
|
| 58 |
+
"""
|
| 59 |
# ----------------------------------------------------------------------
|
| 60 |
# KaTeX delimiter config for Gradio
|
| 61 |
# ----------------------------------------------------------------------
|
|
|
|
| 258 |
logging.exception("Generation streaming failed")
|
| 259 |
yield f"❌ Error during generation: {e}"
|
| 260 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 261 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 262 |
gr.Markdown(TITLE_MD)
|
| 263 |
with gr.Row():
|
|
|
|
| 294 |
value=DEFAULT_REASONING_EFFORT,
|
| 295 |
interactive=True,
|
| 296 |
),
|
| 297 |
+
],
|
| 298 |
examples=[
|
| 299 |
[{"text": "A 68-year-old man complains of several blisters arising over the back and trunk for the preceding 2 weeks. He takes no medications and has not noted systemic symptoms such as fever, sore throat, weight loss, or fatigue. The general physical examination is normal. The oral mucosa and the lips are normal. Several 2- to 3-cm bullae are present over the trunk and back. A few excoriations where the blisters have ruptured are present. The remainder of the skin is normal, without erythema or scale. What is the best diagnostic approach at this time?"}],
|
| 300 |
[{"text": "A 28-year-old woman, gravida 2, para 1, at 40 weeks of gestation is admitted to the hospital in active labor. The patient has attended many prenatal appointments and followed her physician's advice about screening for diseases, laboratory testing, diet, and exercise. Her pregnancy has been uncomplicated. She has no history of a serious illness. Her first child was delivered via normal vaginal delivery. Her vital signs are within normal limits. Cervical examination shows 100% effacement and 10 cm dilation. A cardiotocograph is shown. Which of the following is the most appropriate initial step in management?"}],
|