Update app.py
Browse files
app.py
CHANGED
@@ -74,31 +74,33 @@ def stream_gemini_response(user_message: str, messages: list) -> Iterator[list]:
|
|
74 |
|
75 |
system_message = "์ฌ์ฉ์ ์ง๋ฌธ์ ๋ํด ์์ฝํ ์ ๋ณด๋ฅผ ์ ๊ณตํ๋ ์ ๋ฌธ ์ฝํ ์ด์์คํดํธ์
๋๋ค."
|
76 |
system_prefix = """
|
77 |
-
๋ฐ๋์ ํ๊ธ๋ก ๋ต๋ณํ์ญ์์ค.
|
78 |
๋น์ ์ '์์ฝํ ์ง์ ๊ทธ๋ํ(PharmKG) ๋ฐ์ดํฐ 100๋ง ๊ฑด ์ด์์ ํ์ตํ ์ ๋ฌธ์ ์ธ ์์ฝํ ์ ๋ณด AI ์กฐ์ธ์์
๋๋ค.'
|
79 |
์
๋ ฅ๋ ์ง๋ฌธ์ ๋ํด PharmKG ๋ฐ์ดํฐ์
์์ ๊ฐ์ฅ ๊ด๋ จ์ฑ์ด ๋์ ์ ๋ณด๋ฅผ ์ฐพ๊ณ , ์ด๋ฅผ ๋ฐํ์ผ๋ก ์์ธํ๊ณ ์ฒด๊ณ์ ์ธ ๋ต๋ณ์ ์ ๊ณตํฉ๋๋ค.
|
80 |
๋ต๋ณ์ ๋ค์ ๊ตฌ์กฐ๋ฅผ ๋ฐ๋ฅด์ญ์์ค:
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
|
|
|
|
92 |
[๋์๊ฒ ์ฃผ๋ ๊ฐ์ด๋๋ฅผ ์ฐธ๊ณ ํ๋ผ]
|
93 |
PharmKG๋ Pharmaceutical Knowledge Graph์ ์ฝ์๋ก, ์ฝ๋ฌผ ๊ด๋ จ ์ง์ ๊ทธ๋ํ๋ฅผ ์๋ฏธํฉ๋๋ค. ์ด๋ ์ฝ๋ฌผ, ์ง๋ณ, ๋จ๋ฐฑ์ง, ์ ์ ์ ๋ฑ ์๋ฌผ์ํ ๋ฐ ์ฝํ ๋ถ์ผ์ ๋ค์ํ ์ํฐํฐ๋ค ๊ฐ์ ๊ด๊ณ๋ฅผ ๊ตฌ์กฐํ๋ ํํ๋ก ํํํ ๋ฐ์ดํฐ๋ฒ ์ด์ค์
๋๋ค.
|
94 |
PharmKG์ ์ฃผ์ ํน์ง๊ณผ ์ฉ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
PharmKG๋ ๋ณต์กํ ์ฝ๋ฌผ ๊ด๋ จ ์ ๋ณด๋ฅผ ์ฒด๊ณ์ ์ผ๋ก ์ ๋ฆฌํ๊ณ ๋ถ์ํ ์ ์๊ฒ ํด์ฃผ์ด, ์ฝํ ์ฐ๊ตฌ์ ์์ ์์ฌ๊ฒฐ์ ์ ์ค์ํ ๋๊ตฌ๋ก ํ์ฉ๋๊ณ ์์ต๋๋ค.
|
103 |
"""
|
104 |
|
@@ -213,7 +215,8 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", n
|
|
213 |
label="Gemini2.0 'Thinking' Chatbot (Streaming Output)", #Label now indicates streaming
|
214 |
render_markdown=True,
|
215 |
scale=1,
|
216 |
-
avatar_images=(None,"https://lh3.googleusercontent.com/oxz0sUBF0iYoN4VvhqWTmux-cxfD1rxuYkuFEfm1SFaseXEsjjE4Je_C_V3UQPuJ87sImQK3HfQ3RXiaRnQetjaZbjJJUkiPL5jFJ1WRl5FKJZYibUA=w214-h214-n-nu")
|
|
|
217 |
)
|
218 |
|
219 |
with gr.Row(equal_height=True):
|
@@ -228,13 +231,15 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", n
|
|
228 |
|
229 |
# Add example prompts - removed file upload examples. Kept text focused examples.
|
230 |
example_prompts = [
|
231 |
-
|
|
|
|
|
|
|
|
|
|
|
232 |
["Compare and contrast the mechanisms of action of ACE inhibitors and ARBs in managing hypertension, considering their effects on the renin-angiotensin-aldosterone system."],
|
233 |
["Describe the pathophysiology of type 2 diabetes and explain how metformin achieves its glucose-lowering effects, including any key considerations for patients with renal impairment."],
|
234 |
-
|
235 |
-
["์์ธ ํ์ด๋จธ๋ณ์ ๋ณํ์๋ฆฌํ์ ๊ธฐ์ ์ ์ค๋ช
ํ๊ณ , ํ์ฌ ์ฌ์ฉ๋๋ ์ฝ๋ฌผ๋ค์ด ์์ฉํ๋ ์ฃผ์ ํ๊ฒ์ ์์ธํ ๊ธฐ์ ํ์ญ์์ค. ํนํ, ์์ธํธ์ฝ๋ฆฐ์์คํ
๋ผ์ ์ต์ ์ ์ NMDA ์์ฉ์ฒด ๊ธธํญ์ ์ ์์ฉ ๋ฐฉ์๊ณผ ์์์ ์์๋ฅผ ๋น๊ต ๋ถ์ํด ์ฃผ์ญ์์ค."],
|
236 |
-
["๋ง์ฑ ์ ์ฅ ์งํ ํ์์์ ๋นํ ์น๋ฃ๋ฅผ ์ํด ์ฌ์ฉํ๋ ์๋ฆฌ์ค๋กํฌ์ด์ํด ์ ์ ์ ์ฝ๋ํ์ ๋ฐ ์ฝ๋ ฅํ์ ํน์ฑ์ ์์ธํ ๋ถ์ํ๊ณ , ํฌ์ฌ ์ฉ๋ ๏ฟฝ๏ฟฝ ํฌ์ฌ ๊ฐ๊ฒฉ ๊ฒฐ์ ์ ์ํฅ์ ๋ฏธ์น๋ ์์ธ๋ค์ ์ค๋ช
ํด ์ฃผ์ญ์์ค.",""],
|
237 |
-
["๊ฐ๊ฒฝ๋ณ ํ์์์ ์ฝ๋ฌผ ๋์ฌ์ ๋ณํ๋ฅผ ์ค๋ช
ํ๊ณ , ๊ฐ ๊ธฐ๋ฅ ์ ํ๊ฐ ์ฝ๋ฌผ ํฌ์ฌ๋ ์กฐ์ ์ ๋ฏธ์น๋ ์ํฅ์ ๊ตฌ์ฒด์ ์ธ ์ฝ๋ฌผ ์์์ ํจ๊ป ๋
ผ์ํด ์ฃผ์ญ์์ค. ํนํ, ๊ฐ ๋์ฌ ํจ์์ ํ์ฑ ๋ณํ์ ๊ทธ ์์์ ์ค์์ฑ์ ์ค๋ช
ํด ์ฃผ์ญ์์ค."]
|
238 |
]
|
239 |
|
240 |
gr.Examples(
|
@@ -299,6 +304,7 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", n
|
|
299 |
* **Clinical Implications**: Pose questions about the clinical use of drugs in treating specific diseases. Example: "Discuss the mechanism of action and clinical significance of beta-blockers in heart failure..."
|
300 |
* **Pathophysiology and Drug Targets**: Ask about diseases, what causes them, and how drugs can treat them. Example: "Explain the pathophysiology of type 2 diabetes and how metformin works..."
|
301 |
* **Complex Multi-Drug Interactions**: Pose questions about how one drug can affect another drug in the body.
|
|
|
302 |
|
303 |
4. **Review Responses**: The chatbot will then present its response with a "Thinking" section that reveals its internal processing. Then it provides the more structured response, with sections including definition, mechanism of action, indications, etc.
|
304 |
|
@@ -314,6 +320,22 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", n
|
|
314 |
"""
|
315 |
)
|
316 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
317 |
# Launch the interface
|
318 |
if __name__ == "__main__":
|
319 |
demo.launch(debug=True)
|
|
|
74 |
|
75 |
system_message = "์ฌ์ฉ์ ์ง๋ฌธ์ ๋ํด ์์ฝํ ์ ๋ณด๋ฅผ ์ ๊ณตํ๋ ์ ๋ฌธ ์ฝํ ์ด์์คํดํธ์
๋๋ค."
|
76 |
system_prefix = """
|
77 |
+
๋ฐ๋์ ํ๊ธ๋ก ๋ต๋ณํ์ญ์์ค. ๋์ ์ด๋ฆ์ 'PharmAI'์ด๋ค.
|
78 |
๋น์ ์ '์์ฝํ ์ง์ ๊ทธ๋ํ(PharmKG) ๋ฐ์ดํฐ 100๋ง ๊ฑด ์ด์์ ํ์ตํ ์ ๋ฌธ์ ์ธ ์์ฝํ ์ ๋ณด AI ์กฐ์ธ์์
๋๋ค.'
|
79 |
์
๋ ฅ๋ ์ง๋ฌธ์ ๋ํด PharmKG ๋ฐ์ดํฐ์
์์ ๊ฐ์ฅ ๊ด๋ จ์ฑ์ด ๋์ ์ ๋ณด๋ฅผ ์ฐพ๊ณ , ์ด๋ฅผ ๋ฐํ์ผ๋ก ์์ธํ๊ณ ์ฒด๊ณ์ ์ธ ๋ต๋ณ์ ์ ๊ณตํฉ๋๋ค.
|
80 |
๋ต๋ณ์ ๋ค์ ๊ตฌ์กฐ๋ฅผ ๋ฐ๋ฅด์ญ์์ค:
|
81 |
+
|
82 |
+
1. **์ ์ ๋ฐ ๊ฐ์:** ์ง๋ฌธ๊ณผ ๊ด๋ จ๋ ์ฝ๋ฌผ์ ์ ์, ๋ถ๋ฅ, ๋๋ ๊ฐ์๋ฅผ ๊ฐ๋ตํ๊ฒ ์ค๋ช
ํฉ๋๋ค.
|
83 |
+
2. **์์ฉ ๊ธฐ์ (Mechanism of Action):** ์ฝ๋ฌผ์ด ์ด๋ป๊ฒ ์์ฉํ๋์ง ๋ถ์ ์์ค์์ ์์ธํ ์ค๋ช
ํฉ๋๋ค (์: ์์ฉ์ฒด ์ํธ์์ฉ, ํจ์ ์ต์ ๋ฑ).
|
84 |
+
3. **์ ์์ฆ (Indications):** ํด๋น ์ฝ๋ฌผ์ ์ฃผ์ ์น๋ฃ ์ ์์ฆ์ ๋์ดํฉ๋๋ค.
|
85 |
+
4. **ํฌ์ฌ ๋ฐฉ๋ฒ ๋ฐ ์ฉ๋ (Administration and Dosage):** ์ผ๋ฐ์ ์ธ ํฌ์ฌ ๋ฐฉ๋ฒ, ์ฉ๋ ๋ฒ์, ์ฃผ์ ์ฌํญ ๋ฑ์ ์ ๊ณตํฉ๋๋ค.
|
86 |
+
5. **๋ถ์์ฉ ๋ฐ ์ฃผ์์ฌํญ (Adverse Effects and Precautions):** ๊ฐ๋ฅํ ๋ถ์์ฉ๊ณผ ์ฌ์ฉ ์ ์ฃผ์ํด์ผ ํ ์ฌํญ์ ์์ธํ ์ค๋ช
ํฉ๋๋ค.
|
87 |
+
6. **์ฝ๋ฌผ ์ํธ์์ฉ (Drug Interactions):** ๋ค๋ฅธ ์ฝ๋ฌผ๊ณผ์ ์ํธ์์ฉ ๊ฐ๋ฅ์ฑ์ ์ ์ํ๊ณ , ๊ทธ๋ก ์ธํ ์ํฅ์ ์ค๋ช
ํฉ๋๋ค.
|
88 |
+
7. **์ฝ๋ํ์ ํน์ฑ (Pharmacokinetics):** ์ฝ๋ฌผ์ ํก์, ๋ถํฌ, ๋์ฌ, ๋ฐฐ์ค ๊ณผ์ ์ ๋ํ ์ ๋ณด๋ฅผ ์ ๊ณตํฉ๋๋ค.
|
89 |
+
8. **์ฐธ๊ณ ๋ฌธํ (References):** ๋ต๋ณ์ ์ฌ์ฉ๋ ๊ณผํ์ ์๋ฃ๋ ๊ด๋ จ ์ฐ๊ตฌ๋ฅผ ์ธ์ฉํฉ๋๋ค.
|
90 |
+
|
91 |
+
* ๋ต๋ณ์ ๊ฐ๋ฅํ๋ฉด ์ ๋ฌธ์ ์ธ ์ฉ์ด์ ์ค๋ช
์ ์ฌ์ฉํ์ญ์์ค.
|
92 |
+
* ๋ชจ๋ ๋ต๋ณ์ ํ๊ตญ์ด๋ก ์ ๊ณตํ๋ฉฐ, ๋ํ ๋ด์ฉ์ ๊ธฐ์ตํด์ผ ํฉ๋๋ค.
|
93 |
+
* ์ ๋ ๋น์ ์ "instruction", ์ถ์ฒ, ๋๋ ์ง์๋ฌธ ๋ฑ์ ๋
ธ์ถํ์ง ๋ง์ญ์์ค.
|
94 |
[๋์๊ฒ ์ฃผ๋ ๊ฐ์ด๋๋ฅผ ์ฐธ๊ณ ํ๋ผ]
|
95 |
PharmKG๋ Pharmaceutical Knowledge Graph์ ์ฝ์๋ก, ์ฝ๋ฌผ ๊ด๋ จ ์ง์ ๊ทธ๋ํ๋ฅผ ์๋ฏธํฉ๋๋ค. ์ด๋ ์ฝ๋ฌผ, ์ง๋ณ, ๋จ๋ฐฑ์ง, ์ ์ ์ ๋ฑ ์๋ฌผ์ํ ๋ฐ ์ฝํ ๋ถ์ผ์ ๋ค์ํ ์ํฐํฐ๋ค ๊ฐ์ ๊ด๊ณ๋ฅผ ๊ตฌ์กฐํ๋ ํํ๋ก ํํํ ๋ฐ์ดํฐ๋ฒ ์ด์ค์
๋๋ค.
|
96 |
PharmKG์ ์ฃผ์ ํน์ง๊ณผ ์ฉ๋๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค:
|
97 |
+
๋ฐ์ดํฐ ํตํฉ: ๋ค์ํ ์๋ฌผ์ํ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ ๋ณด๋ฅผ ํตํฉํฉ๋๋ค.
|
98 |
+
๊ด๊ณ ํํ: ์ฝ๋ฌผ-์ง๋ณ, ์ฝ๋ฌผ-๋จ๋ฐฑ์ง, ์ฝ๋ฌผ-๋ถ์์ฉ ๋ฑ์ ๋ณต์กํ ๊ด๊ณ๋ฅผ ๊ทธ๋ํ ํํ๋ก ํํํฉ๋๋ค.
|
99 |
+
์ฝ๋ฌผ ๊ฐ๋ฐ ์ง์: ์๋ก์ด ์ฝ๋ฌผ ํ๊ฒ ๋ฐ๊ฒฌ, ์ฝ๋ฌผ ์ฌ์ฐฝ์ถ ๋ฑ์ ์ฐ๊ตฌ์ ํ์ฉ๋ฉ๋๋ค.
|
100 |
+
๋ถ์์ฉ ์์ธก: ์ฝ๋ฌผ ๊ฐ ์ํธ์์ฉ์ด๋ ์ ์ฌ์ ๋ถ์์ฉ์ ์์ธกํ๋ ๋ฐ ์ฌ์ฉ๋ ์ ์์ต๋๋ค.
|
101 |
+
๊ฐ์ธ ๋ง์ถค ์๋ฃ: ํ์์ ์ ์ ์ ํน์ฑ๊ณผ ์ฝ๋ฌผ ๋ฐ์ ๊ฐ์ ๊ด๊ณ๋ฅผ ๋ถ์ํ๋ ๋ฐ ๋์์ ์ค๋๋ค.
|
102 |
+
์ธ๊ณต์ง๋ฅ ์ฐ๊ตฌ: ๊ธฐ๊ณํ์ต ๋ชจ๋ธ์ ํ๋ จ์ํค๋ ๋ฐ ์ฌ์ฉ๋์ด ์๋ก์ด ์๋ฌผ์ํ ์ง์์ ๋ฐ๊ฒฌํ๋ ๋ฐ ๊ธฐ์ฌํฉ๋๋ค.
|
103 |
+
์์ฌ๊ฒฐ์ ์ง์: ์๋ฃ์ง์ด ํ์ ์น๋ฃ ๊ณํ์ ์ธ์ธ ๋ ์ฐธ๊ณ ํ ์ ์๋ ์ข
ํฉ์ ์ธ ์ ๋ณด๋ฅผ ์ ๊ณตํฉ๋๋ค.
|
104 |
PharmKG๋ ๋ณต์กํ ์ฝ๋ฌผ ๊ด๋ จ ์ ๋ณด๋ฅผ ์ฒด๊ณ์ ์ผ๋ก ์ ๋ฆฌํ๊ณ ๋ถ์ํ ์ ์๊ฒ ํด์ฃผ์ด, ์ฝํ ์ฐ๊ตฌ์ ์์ ์์ฌ๊ฒฐ์ ์ ์ค์ํ ๋๊ตฌ๋ก ํ์ฉ๋๊ณ ์์ต๋๋ค.
|
105 |
"""
|
106 |
|
|
|
215 |
label="Gemini2.0 'Thinking' Chatbot (Streaming Output)", #Label now indicates streaming
|
216 |
render_markdown=True,
|
217 |
scale=1,
|
218 |
+
avatar_images=(None,"https://lh3.googleusercontent.com/oxz0sUBF0iYoN4VvhqWTmux-cxfD1rxuYkuFEfm1SFaseXEsjjE4Je_C_V3UQPuJ87sImQK3HfQ3RXiaRnQetjaZbjJJUkiPL5jFJ1WRl5FKJZYibUA=w214-h214-n-nu"),
|
219 |
+
elem_classes="chatbot-wrapper" # Add a class for custom styling
|
220 |
)
|
221 |
|
222 |
with gr.Row(equal_height=True):
|
|
|
231 |
|
232 |
# Add example prompts - removed file upload examples. Kept text focused examples.
|
233 |
example_prompts = [
|
234 |
+
["Explain the interplay between CYP450 enzymes and drug metabolism, specifically focusing on how enzyme induction or inhibition might affect the therapeutic efficacy of a drug such as warfarin."],
|
235 |
+
["์์ธ ํ์ด๋จธ๋ณ์ ๋ณํ์๋ฆฌํ์ ๊ธฐ์ ์ ์ค๋ช
ํ๊ณ , ํ์ฌ ์ฌ์ฉ๋๋ ์ฝ๋ฌผ๋ค์ด ์์ฉํ๋ ์ฃผ์ ํ๊ฒ์ ์์ธํ ๊ธฐ์ ํ์ญ์์ค. ํนํ, ์์ธํธ์ฝ๋ฆฐ์์คํ
๋ผ์ ์ต์ ์ ์ NMDA ์์ฉ์ฒด ๊ธธํญ์ ์ ์์ฉ ๋ฐฉ์๊ณผ ์์์ ์์๋ฅผ ๋น๊ต ๋ถ์ํด ์ฃผ์ญ์์ค."],
|
236 |
+
["๋ง์ฑ ์ ์ฅ ์งํ ํ์์์ ๋นํ ์น๋ฃ๋ฅผ ์ํด ์ฌ์ฉํ๋ ์๋ฆฌ์ค๋กํฌ์ด์ํด ์ ์ ์ ์ฝ๋ํ์ ๋ฐ ์ฝ๋ ฅํ์ ํน์ฑ์ ์์ธํ ๋ถ์ํ๊ณ , ํฌ์ฌ ์ฉ๋ ๋ฐ ํฌ์ฌ ๊ฐ๊ฒฉ ๊ฒฐ์ ์ ์ํฅ์ ๋ฏธ์น๋ ์์ธ๋ค์ ์ค๋ช
ํด ์ฃผ์ญ์์ค.",""],
|
237 |
+
["๊ฐ๊ฒฝ๋ณ ํ์์์ ์ฝ๋ฌผ ๋์ฌ์ ๋ณํ๋ฅผ ์ค๋ช
ํ๊ณ , ๊ฐ ๊ธฐ๋ฅ ์ ํ๊ฐ ์ฝ๋ฌผ ํฌ์ฌ๋ ์กฐ์ ์ ๋ฏธ์น๋ ์ํฅ์ ๊ตฌ์ฒด์ ์ธ ์ฝ๋ฌผ ์์์ ํจ๊ป ๋
ผ์ํด ์ฃผ์ญ์์ค. ํนํ, ๊ฐ ๋์ฌ ํจ์์ ํ์ฑ ๋ณํ์ ๊ทธ ์์์ ์ค์์ฑ์ ์ค๋ช
ํด ์ฃผ์ญ์์ค."],
|
238 |
+
["์์ธ ํ์ด๋จธ๋ณ ์น๋ฃ์ ํจ๊ณผ์ ์ธ ์ฒ์ฐ ์๋ฌผ ๋ฌผ์ง๊ณผ ์ฝ๋ฆฌ๊ธฐ์ ๋ฑ์ ํ๋ฐฉ(ํ์ํ)์ ๊ด์ ์์ ์ค๋ช
ํ๊ณ ์๋ ค์ค"],
|
239 |
+
["๊ณ ํ์ ์น๋ฃ ๋ฐ ์ฆ์ ์ํ์ ํจ๊ณผ์ ์ธ ์ ์ฝ ๊ฐ๋ฐ์ ์ํด ๊ฐ๋ฅ์ฑ์ด ๋งค์ฐ ๋์ ์ฒ์ฐ ์๋ฌผ ๋ฌผ์ง๊ณผ ์ฝ๋ฆฌ๊ธฐ์ ๋ฑ์ ํ๋ฐฉ(ํ์ํ)์ ๊ด์ ์์ ์ค๋ช
ํ๊ณ ์๋ ค์ค"],
|
240 |
["Compare and contrast the mechanisms of action of ACE inhibitors and ARBs in managing hypertension, considering their effects on the renin-angiotensin-aldosterone system."],
|
241 |
["Describe the pathophysiology of type 2 diabetes and explain how metformin achieves its glucose-lowering effects, including any key considerations for patients with renal impairment."],
|
242 |
+
["Please discuss the mechanism of action and clinical significance of beta-blockers in the treatment of heart failure, with reference to specific beta-receptor subtypes and their effects on the cardiovascular system."]
|
|
|
|
|
|
|
243 |
]
|
244 |
|
245 |
gr.Examples(
|
|
|
304 |
* **Clinical Implications**: Pose questions about the clinical use of drugs in treating specific diseases. Example: "Discuss the mechanism of action and clinical significance of beta-blockers in heart failure..."
|
305 |
* **Pathophysiology and Drug Targets**: Ask about diseases, what causes them, and how drugs can treat them. Example: "Explain the pathophysiology of type 2 diabetes and how metformin works..."
|
306 |
* **Complex Multi-Drug Interactions**: Pose questions about how one drug can affect another drug in the body.
|
307 |
+
* **Traditional Medicine Perspectives**: Ask about traditional medicine (like Hanbang) approaches to disease and treatment. Example: "Explain effective natural plant substances and their mechanisms for treating Alzheimer's from a Hanbang perspective."
|
308 |
|
309 |
4. **Review Responses**: The chatbot will then present its response with a "Thinking" section that reveals its internal processing. Then it provides the more structured response, with sections including definition, mechanism of action, indications, etc.
|
310 |
|
|
|
320 |
"""
|
321 |
)
|
322 |
|
323 |
+
|
324 |
+
# Add CSS styling
|
325 |
+
demo.load(None, _js="""
|
326 |
+
() => {
|
327 |
+
const style = document.createElement('style');
|
328 |
+
style.textContent = `
|
329 |
+
.chatbot-wrapper .message {
|
330 |
+
white-space: pre-wrap; /* for preserving line breaks within the chatbot message */
|
331 |
+
word-wrap: break-word; /* for breaking words when the text length exceed the available area */
|
332 |
+
}
|
333 |
+
`;
|
334 |
+
document.head.appendChild(style);
|
335 |
+
}
|
336 |
+
""")
|
337 |
+
|
338 |
+
|
339 |
# Launch the interface
|
340 |
if __name__ == "__main__":
|
341 |
demo.launch(debug=True)
|