CodCodingCode commited on
Commit
678ce59
·
1 Parent(s): 70bea4d

made the tokenizer and model local

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -42,7 +42,9 @@ model.eval()
42
 
43
  # === Role Agent with instruction/input/output format ===
44
  class RoleAgent:
45
- def __init__(self, role_instruction):
 
 
46
  self.role_instruction = role_instruction
47
 
48
  def act(self, input_text):
@@ -102,16 +104,16 @@ def simulate_interaction(user_input, iterations=1):
102
  for i in range(iterations):
103
  # Summarize
104
  sum_in = "\n".join(history) + f"\nPrevious Vignette: {summary}"
105
- sum_out = summarizer.act(sum_in)
106
  summary = sum_out["output"]
107
 
108
  # Diagnose
109
- diag_out = diagnoser.act(summary)
110
  diagnosis = diag_out["output"]
111
 
112
  # Question
113
  q_in = f"Vignette: {summary}\nCurrent Estimated Diagnosis: {diag_out['thinking']} {diagnosis}"
114
- q_out = questioner.act(q_in)
115
  history.append(f"Doctor: {q_out['output']}")
116
  history.append("Patient: (awaiting response)")
117
 
 
42
 
43
  # === Role Agent with instruction/input/output format ===
44
  class RoleAgent:
45
+ def __init__(self, role_instruction, tokenizer, model):
46
+ self.tokenizer = tokenizer
47
+ self.model = model
48
  self.role_instruction = role_instruction
49
 
50
  def act(self, input_text):
 
104
  for i in range(iterations):
105
  # Summarize
106
  sum_in = "\n".join(history) + f"\nPrevious Vignette: {summary}"
107
+ sum_out = summarizer.act(sum_in, tokenizer, model)
108
  summary = sum_out["output"]
109
 
110
  # Diagnose
111
+ diag_out = diagnoser.act(summary, tokenizer, model)
112
  diagnosis = diag_out["output"]
113
 
114
  # Question
115
  q_in = f"Vignette: {summary}\nCurrent Estimated Diagnosis: {diag_out['thinking']} {diagnosis}"
116
+ q_out = questioner.act(q_in, tokenizer, model)
117
  history.append(f"Doctor: {q_out['output']}")
118
  history.append("Patient: (awaiting response)")
119