enshicoolsoda commited on
Commit
29aa4fc
·
verified ·
1 Parent(s): 4425631

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -3
app.py CHANGED
@@ -148,7 +148,29 @@ def respond(message, history):
148
  if history is None: history = []
149
  api_msgs = normalize_history(history)
150
 
151
- sys_prompt = {"role": "system", "content": "You are an oncology research assistant. Format: Summary, Prediction, Factors, Missing Info."}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  current_user_msg = {"role": "user", "content": str(message)}
153
 
154
  response_text = ollama_chat([sys_prompt] + api_msgs + [current_user_msg])
@@ -172,7 +194,7 @@ CSS = """
172
  """
173
 
174
  with gr.Blocks(css=CSS, title="OncoRisk Public Demo") as demo:
175
- gr.HTML('<div id="titlebar"><div class="title-text">OncoRisk Assistant (Remote GPU)</div></div>')
176
  full_data_state = gr.State({})
177
 
178
  with gr.Row():
@@ -216,7 +238,7 @@ with gr.Blocks(css=CSS, title="OncoRisk Public Demo") as demo:
216
  # RIGHT COLUMN: Chat & Analysis
217
  with gr.Column(scale=2):
218
  chatbot = gr.Chatbot(height=550)
219
- msg_input = gr.Textbox(label="Clinical Input (JSON)", lines=6, placeholder="Data will appear here...")
220
  submit_btn = gr.Button("Analyze Case", variant="primary")
221
  gr.ClearButton([msg_input, chatbot])
222
 
 
148
  if history is None: history = []
149
  api_msgs = normalize_history(history)
150
 
151
+ # sys_prompt = {"role": "system", "content": "You are an oncology research assistant. Format: Summary, Prediction, Factors, Missing Info."}
152
+ SYSTEM_PROMPT = """You are an oncology research assistant. Analyze the patient data and output strictly in this exact format:
153
+
154
+ === Summary ===
155
+ The patient is a [Age] year-old [Sex] with Stage [Stage], [Cancer Type] at diagnosis.
156
+
157
+ === Prediction ===
158
+ - 1-year cancer survival: [Estimated %]
159
+ - 1-year cancer recurrence: [Estimated %]
160
+ - 5-year cancer survival: [Estimated %]
161
+ - 5-year cancer recurrence: [Estimated %]
162
+
163
+ === Factors affecting prediction ===
164
+ - 1-year survival: [1-2 concise reasons based on data]
165
+ - 1-year recurrence: [1-2 concise reasons based on data]
166
+ - 5-year survival: [1-2 concise reasons based on data]
167
+ - 5-year recurrence: [1-2 concise reasons based on data]
168
+
169
+ === Missing Information ===
170
+ - [List any missing key clinical fields, or state 'None detected']
171
+ """
172
+
173
+ sys_prompt = {"role": "system", "content": SYSTEM_PROMPT}
174
  current_user_msg = {"role": "user", "content": str(message)}
175
 
176
  response_text = ollama_chat([sys_prompt] + api_msgs + [current_user_msg])
 
194
  """
195
 
196
  with gr.Blocks(css=CSS, title="OncoRisk Public Demo") as demo:
197
+ gr.HTML('<div id="titlebar"><div class="title-text">Oncology Chat (developing)</div></div>')
198
  full_data_state = gr.State({})
199
 
200
  with gr.Row():
 
238
  # RIGHT COLUMN: Chat & Analysis
239
  with gr.Column(scale=2):
240
  chatbot = gr.Chatbot(height=550)
241
+ msg_input = gr.Textbox(label="Input Box", lines=6, placeholder="Ask anything oncology related")
242
  submit_btn = gr.Button("Analyze Case", variant="primary")
243
  gr.ClearButton([msg_input, chatbot])
244