Spaces:
Runtime error
Runtime error
The 'doctor' is now a 'static' method.
Browse files
app.py
CHANGED
|
@@ -368,8 +368,9 @@ peft_model = PeftModel.from_pretrained(peft_model, "Tonic/stablemed", token=hf_t
|
|
| 368 |
class ChatBot:
|
| 369 |
def __init__(self):
|
| 370 |
self.history = []
|
| 371 |
-
|
| 372 |
-
|
|
|
|
| 373 |
formatted_input = f"{system_prompt}{user_input}"
|
| 374 |
user_input_ids = tokenizer.encode(formatted_input, return_tensors="pt")
|
| 375 |
response = peft_model.generate(input_ids=user_input_ids, max_length=512, pad_token_id=tokenizer.eos_token_id)
|
|
|
|
| 368 |
class ChatBot:
|
| 369 |
def __init__(self):
|
| 370 |
self.history = []
|
| 371 |
+
|
| 372 |
+
@staticmethod
|
| 373 |
+
def doctor(user_input, system_prompt="You are an expert medical analyst:"):
|
| 374 |
formatted_input = f"{system_prompt}{user_input}"
|
| 375 |
user_input_ids = tokenizer.encode(formatted_input, return_tensors="pt")
|
| 376 |
response = peft_model.generate(input_ids=user_input_ids, max_length=512, pad_token_id=tokenizer.eos_token_id)
|