CodCodingCode commited on
Commit
330b156
·
1 Parent(s): 2401693
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -88,7 +88,6 @@ class RoleAgent:
88
  response = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
89
 
90
  thinking = ""
91
- print(f"[RESPONSE]: {response}")
92
  answer = response
93
  if "Output:" in response:
94
  # Split on the last occurrence of 'Output:' in case it's repeated
@@ -101,6 +100,15 @@ class RoleAgent:
101
  block = response.split("THINKING:", 1)[1].split("END", 1)[0]
102
  thinking = block.split("ANSWER:", 1)[0].strip()
103
  answer = block.split("ANSWER:", 1)[1].strip()
 
 
 
 
 
 
 
 
 
104
 
105
  return {"thinking": thinking, "output": answer}
106
 
@@ -164,7 +172,11 @@ def simulate_interaction(user_input, iterations=1):
164
  diagnosis = diag_out["output"]
165
 
166
  # Question
167
- q_in = f"Vignette: {summary}\nCurrent Estimated Diagnosis: {diag_out['thinking']} {diagnosis}"
 
 
 
 
168
  q_out = questioner.act(q_in)
169
  history.append(f"Doctor: {q_out['output']}")
170
  # Append actual user input to keep the conversation realistic
 
88
  response = self.tokenizer.decode(outputs[0], skip_special_tokens=True)
89
 
90
  thinking = ""
 
91
  answer = response
92
  if "Output:" in response:
93
  # Split on the last occurrence of 'Output:' in case it's repeated
 
100
  block = response.split("THINKING:", 1)[1].split("END", 1)[0]
101
  thinking = block.split("ANSWER:", 1)[0].strip()
102
  answer = block.split("ANSWER:", 1)[1].strip()
103
+ print(
104
+ "[DEBUG] thinking/answer split:",
105
+ response,
106
+ "→",
107
+ "[THINKING] thinking:",
108
+ thinking,
109
+ "[ANSWER] answer:",
110
+ answer,
111
+ )
112
 
113
  return {"thinking": thinking, "output": answer}
114
 
 
172
  diagnosis = diag_out["output"]
173
 
174
  # Question
175
+ q_in = (
176
+ f"Vignette: {summary}\n"
177
+ f"Current Estimated Diagnosis:\n"
178
+ f"ANSWER: {diagnosis}"
179
+ )
180
  q_out = questioner.act(q_in)
181
  history.append(f"Doctor: {q_out['output']}")
182
  # Append actual user input to keep the conversation realistic