Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,18 +31,10 @@ def askme(symptoms, question):
|
|
31 |
outputs = model.generate(**inputs, max_new_tokens=200, use_cache=True)
|
32 |
response_text = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0].strip() #skip_special_tokens=True
|
33 |
# Remove system messages and content
|
34 |
-
# Extract only the assistant's response
|
35 |
-
#assistant_response = response_text.split("<|im_start|>assistant")[1].strip().replace('<|im_end|>', '')
|
36 |
# Extract only the assistant's response
|
37 |
assistant_response =response_text.split("assistant")[1].strip().split("user")[0].strip()
|
38 |
return assistant_response
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
# Example usage
|
47 |
symptoms = '''\
|
48 |
I'm a 35-year-old male and for the past few months, I've been experiencing fatigue,
|
@@ -59,7 +51,7 @@ examples = [
|
|
59 |
|
60 |
iface = gr.Interface(
|
61 |
fn=askme,
|
62 |
-
inputs=["
|
63 |
outputs="text",
|
64 |
examples=examples,
|
65 |
title="Medical AI Chatbot",
|
|
|
31 |
outputs = model.generate(**inputs, max_new_tokens=200, use_cache=True)
|
32 |
response_text = tokenizer.batch_decode(outputs, skip_special_tokens=True)[0].strip() #skip_special_tokens=True
|
33 |
# Remove system messages and content
|
|
|
|
|
34 |
# Extract only the assistant's response
|
35 |
assistant_response =response_text.split("assistant")[1].strip().split("user")[0].strip()
|
36 |
return assistant_response
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
# Example usage
|
39 |
symptoms = '''\
|
40 |
I'm a 35-year-old male and for the past few months, I've been experiencing fatigue,
|
|
|
51 |
|
52 |
iface = gr.Interface(
|
53 |
fn=askme,
|
54 |
+
inputs=["Symptoms", "Question"],
|
55 |
outputs="text",
|
56 |
examples=examples,
|
57 |
title="Medical AI Chatbot",
|