cmcmaster commited on
Commit
08d9d5b
·
verified ·
1 Parent(s): 146869e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -16
app.py CHANGED
@@ -13,13 +13,8 @@ import spaces # Import spaces early to enable ZeroGPU support
13
  # ------------------------------
14
  cancel_event = threading.Event()
15
 
16
- # ------------------------------
17
- # Qwen3 Model Definitions
18
- # ------------------------------
19
- # Single-model configuration
20
- MODEL_REPO = "unsloth/medgemma-27b-text-it"
21
  MODELS = {
22
- "Qwen3-8B": {"repo_id": "unsloth/medgemma-27b-text-it", "description": "Med Gemma for medical chat."}
23
  }
24
 
25
  # Global cache for pipelines to avoid re-loading.
@@ -122,7 +117,7 @@ def bot_response(history, system_prompt, model_selection, max_tokens, temperatur
122
 
123
  def get_default_system_prompt():
124
  today = datetime.now().strftime('%Y-%m-%d')
125
- return f"""You are Qwen3, a helpful and friendly AI assistat. Be concise, accurate, and helpful in your responses."""
126
 
127
  def clear_chat():
128
  return []
@@ -132,7 +127,7 @@ css = """
132
  .gradio-container {
133
  background-color: #f5f7fb !important;
134
  }
135
- .qwen-header {
136
  background: linear-gradient(90deg, #0099FF, #0066CC);
137
  padding: 20px;
138
  border-radius: 10px;
@@ -141,7 +136,7 @@ css = """
141
  color: white;
142
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
143
  }
144
- .qwen-container {
145
  border-radius: 10px;
146
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
147
  background: white;
@@ -177,19 +172,19 @@ css = """
177
  # ------------------------------
178
  # Gradio UI
179
  # ------------------------------
180
- with gr.Blocks(title="Qwen3 Chat", css=css) as demo:
181
  gr.HTML("""
182
- <div class="qwen-header">
183
- <h1>🤖 Qwen3 Chat</h1>
184
- <p>Interact with Alibaba Cloud's Qwen3 language models</p>
185
  </div>
186
  """)
187
 
188
  with gr.Row():
189
  with gr.Column(scale=3):
190
- with gr.Group(elem_classes="qwen-container"):
191
  model_dd = gr.Dropdown(
192
- label="Select Qwen3 Model",
193
  choices=[f"{k} - {v['description']}" for k, v in MODELS.items()],
194
  value=f"{list(MODELS.keys())[0]} - {MODELS[list(MODELS.keys())[0]]['description']}",
195
  elem_classes="model-select"
@@ -221,7 +216,6 @@ with gr.Blocks(title="Qwen3 Chat", css=css) as demo:
221
 
222
  gr.HTML("""
223
  <div class="footer">
224
- <p>Qwen3 models developed by Alibaba Cloud. Interface powered by Gradio and ZeroGPU.</p>
225
  </div>
226
  """)
227
 
 
13
  # ------------------------------
14
  cancel_event = threading.Event()
15
 
 
 
 
 
 
16
  MODELS = {
17
+ "MedGemma": {"repo_id": "unsloth/medgemma-27b-text-it", "description": "Med Gemma for medical chat."}
18
  }
19
 
20
  # Global cache for pipelines to avoid re-loading.
 
117
 
118
  def get_default_system_prompt():
119
  today = datetime.now().strftime('%Y-%m-%d')
120
+ return f"""You are a helpful medical assistant."""
121
 
122
  def clear_chat():
123
  return []
 
127
  .gradio-container {
128
  background-color: #f5f7fb !important;
129
  }
130
+ .medgemma-header {
131
  background: linear-gradient(90deg, #0099FF, #0066CC);
132
  padding: 20px;
133
  border-radius: 10px;
 
136
  color: white;
137
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
138
  }
139
+ .medgemma-container {
140
  border-radius: 10px;
141
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
142
  background: white;
 
172
  # ------------------------------
173
  # Gradio UI
174
  # ------------------------------
175
+ with gr.Blocks(title="MedGemma Chat", css=css) as demo:
176
  gr.HTML("""
177
+ <div class="medgemma-header">
178
+ <h1>🤖 MedGemma Chat</h1>
179
+ <p>Interact with Alibaba Cloud's MedGemma language models</p>
180
  </div>
181
  """)
182
 
183
  with gr.Row():
184
  with gr.Column(scale=3):
185
+ with gr.Group(elem_classes="medgemma-container"):
186
  model_dd = gr.Dropdown(
187
+ label="Select MedGemma Model",
188
  choices=[f"{k} - {v['description']}" for k, v in MODELS.items()],
189
  value=f"{list(MODELS.keys())[0]} - {MODELS[list(MODELS.keys())[0]]['description']}",
190
  elem_classes="model-select"
 
216
 
217
  gr.HTML("""
218
  <div class="footer">
 
219
  </div>
220
  """)
221