Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -21,7 +21,7 @@ def askme(symptoms, question):
|
|
21 |
You are an AI Medical Assistant trained on a vast dataset of health information. Please be thorough and
|
22 |
provide an informative answer. If you don't know the answer to a specific medical inquiry, advise seeking professional help.
|
23 |
'''
|
24 |
-
content = symptoms + "
|
25 |
messages = [{"role": "system", "content": sys_message}, {"role": "user", "content": content}]
|
26 |
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
27 |
inputs = tokenizer(prompt, return_tensors="pt").to(device) # Ensure inputs are on CUDA device
|
@@ -30,9 +30,9 @@ def askme(symptoms, question):
|
|
30 |
# Remove system messages and content
|
31 |
# Extract and return the generated text, removing the prompt
|
32 |
# Extract only the assistant's response
|
33 |
-
answer = response_text.split('<|im_start|>assistant')[-1].strip()
|
34 |
#answer =response_text.split("assistant")[1].strip().split("user")[0].strip()
|
35 |
-
return
|
36 |
|
37 |
# Example usage
|
38 |
symptoms = '''\
|
|
|
21 |
You are an AI Medical Assistant trained on a vast dataset of health information. Please be thorough and
|
22 |
provide an informative answer. If you don't know the answer to a specific medical inquiry, advise seeking professional help.
|
23 |
'''
|
24 |
+
content = "symptoms:"+ symptoms + "question:" + question
|
25 |
messages = [{"role": "system", "content": sys_message}, {"role": "user", "content": content}]
|
26 |
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
27 |
inputs = tokenizer(prompt, return_tensors="pt").to(device) # Ensure inputs are on CUDA device
|
|
|
30 |
# Remove system messages and content
|
31 |
# Extract and return the generated text, removing the prompt
|
32 |
# Extract only the assistant's response
|
33 |
+
#answer = response_text.split('<|im_start|>assistant')[-1].strip()
|
34 |
#answer =response_text.split("assistant")[1].strip().split("user")[0].strip()
|
35 |
+
return response_text
|
36 |
|
37 |
# Example usage
|
38 |
symptoms = '''\
|