Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -45,49 +45,35 @@ rag_chain = (
|
|
45 |
| llm
|
46 |
| StrOutputParser()
|
47 |
)
|
|
|
48 |
import gradio as gr
|
49 |
|
50 |
-
|
51 |
-
def handle_prompt(message, history):
|
52 |
partial_text = ""
|
53 |
for new_text in rag_chain.stream(message):
|
54 |
partial_text += new_text
|
55 |
yield partial_text
|
56 |
|
57 |
-
|
58 |
-
|
59 |
-
if __name__=="__main__":
|
60 |
-
|
61 |
-
# Predefined messages and examples
|
62 |
-
greetingsmessage = """Hello! Welcome to MediGuide ChatBot. I'm here to provide you with quick and accurate information on medical drugs.
|
63 |
-
Whether you need details on usage, side effects, etc., feel free to ask. Let's enhance patient care together!"""
|
64 |
-
|
65 |
-
description = """
|
66 |
-
|
67 |
-
Hello! Welcome to MediGuide ChatBot,AI-powered assistant designed to facilitate healthcare providers to make informed decision-making by providing reliable information about various medical drugs, including their uses, side effects, contraindications and classification."""
|
68 |
-
|
69 |
-
example_questions = [
|
70 |
"What are the Side effects of Doxycycline",
|
71 |
"Can Doxycycline Treat Acnes",
|
72 |
"Which Classification is Doxycycline"
|
73 |
]
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
# Define Gradio interface
|
81 |
-
demo = gr.ChatInterface(handle_prompt,
|
82 |
type="messages",
|
83 |
-
title=
|
84 |
-
examples=example_questions,
|
85 |
-
theme=gr.themes.Soft(),
|
86 |
description=description,
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
|
92 |
|
|
|
|
|
93 |
|
|
|
45 |
| llm
|
46 |
| StrOutputParser()
|
47 |
)
|
48 |
+
|
49 |
import gradio as gr
|
50 |
|
51 |
+
def rag_memory_stream(message, history):
|
|
|
52 |
partial_text = ""
|
53 |
for new_text in rag_chain.stream(message):
|
54 |
partial_text += new_text
|
55 |
yield partial_text
|
56 |
|
57 |
+
examples = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
"What are the Side effects of Doxycycline",
|
59 |
"Can Doxycycline Treat Acnes",
|
60 |
"Which Classification is Doxycycline"
|
61 |
]
|
62 |
+
|
63 |
+
description = "Hello! Welcome to MediGuide ChatBot,AI-powered assistant designed to facilitate healthcare providers to make informed decision-making by providing reliable information about various medical drugs, including their uses, side effects, contraindications and classification"
|
64 |
+
|
65 |
+
|
66 |
+
title = "MediGuide ChatBot"
|
67 |
+
demo = gr.ChatInterface(fn=rag_memory_stream,
|
|
|
|
|
68 |
type="messages",
|
69 |
+
title=title,
|
|
|
|
|
70 |
description=description,
|
71 |
+
fill_height=True,
|
72 |
+
examples=examples,
|
73 |
+
theme=gr.themes.Soft(),
|
74 |
+
)
|
75 |
|
76 |
|
77 |
+
if __name__ == "__main__":
|
78 |
+
demo.launch()
|
79 |
|