Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,14 +7,9 @@ df = df[['drug_name', 'medical_condition', 'side_effects']]
|
|
| 7 |
df.dropna(inplace=True)
|
| 8 |
|
| 9 |
context_data = []
|
| 10 |
-
for i in range(
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
context += df.columns[j]
|
| 14 |
-
context += ": "
|
| 15 |
-
context += str(df.iloc[i][j])
|
| 16 |
-
context += " "
|
| 17 |
-
context_data.append(context)
|
| 18 |
|
| 19 |
import os
|
| 20 |
|
|
@@ -84,21 +79,14 @@ def rag_memory_stream(text):
|
|
| 84 |
# Title and description for the app
|
| 85 |
title = "AI Medical Assistant for Drug Information and Side Effects"
|
| 86 |
description = """
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
<li>What is the disease for constant fatigue and muscle weakness?</li>
|
| 96 |
-
<li>What are the symptoms of diabetes?</li>
|
| 97 |
-
<li>How can hypertension be managed?</li>
|
| 98 |
-
</ul>
|
| 99 |
-
|
| 100 |
-
<strong>Disclaimer:</strong> This chatbot is for informational purposes only and is not a substitute for professional medical advice.
|
| 101 |
-
</div>
|
| 102 |
"""
|
| 103 |
|
| 104 |
# Customizing Gradio interface for a better look
|
|
@@ -108,37 +96,30 @@ custom_css = """
|
|
| 108 |
body {
|
| 109 |
background-color: #f9f9f9;
|
| 110 |
font-family: Arial, sans-serif;
|
| 111 |
-
margin: 0;
|
| 112 |
-
padding: 0;
|
| 113 |
}
|
| 114 |
|
| 115 |
#interface-container {
|
| 116 |
max-width: 800px;
|
| 117 |
-
margin:
|
| 118 |
padding: 20px;
|
| 119 |
-
background: linear-gradient(145deg, #f0f0f0, #
|
| 120 |
-
|
| 121 |
border-radius: 10px;
|
| 122 |
-
|
| 123 |
}
|
| 124 |
|
| 125 |
-
h1 {
|
| 126 |
-
text-align: center;
|
| 127 |
color: #333;
|
| 128 |
}
|
| 129 |
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
color: #000;
|
| 133 |
-
font-size: 1rem;
|
| 134 |
-
margin-bottom: 20px;
|
| 135 |
}
|
| 136 |
|
| 137 |
footer {
|
| 138 |
text-align: center;
|
| 139 |
color: #777;
|
| 140 |
-
margin-top:
|
| 141 |
-
font-size: 0.9rem;
|
| 142 |
}
|
| 143 |
"""
|
| 144 |
|
|
|
|
| 7 |
df.dropna(inplace=True)
|
| 8 |
|
| 9 |
context_data = []
|
| 10 |
+
for i in range(10):
|
| 11 |
+
context = " | ".join([f"{col}: {df.iloc[i][col]}" for col in df.columns])
|
| 12 |
+
context_data.append(context)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
import os
|
| 15 |
|
|
|
|
| 79 |
# Title and description for the app
|
| 80 |
title = "AI Medical Assistant for Drug Information and Side Effects"
|
| 81 |
description = """
|
| 82 |
+
This AI-powered chatbot provides reliable information about drugs, their side effects, and related medical conditions.
|
| 83 |
+
Powered by the Groq API and LangChain, it delivers real-time, accurate responses.
|
| 84 |
+
|
| 85 |
+
Example Questions:
|
| 86 |
+
- What are the side effects of aspirin?
|
| 87 |
+
- What is the disease for constant fatigue and muscle weakness?
|
| 88 |
+
|
| 89 |
+
Disclaimer: This chatbot is for informational purposes only and not a substitute for professional medical advice.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 90 |
"""
|
| 91 |
|
| 92 |
# Customizing Gradio interface for a better look
|
|
|
|
| 96 |
body {
|
| 97 |
background-color: #f9f9f9;
|
| 98 |
font-family: Arial, sans-serif;
|
|
|
|
|
|
|
| 99 |
}
|
| 100 |
|
| 101 |
#interface-container {
|
| 102 |
max-width: 800px;
|
| 103 |
+
margin: auto;
|
| 104 |
padding: 20px;
|
| 105 |
+
background: linear-gradient(145deg, #f0f0f0, #ffffff);
|
| 106 |
+
border: 1px solid #ccc;
|
| 107 |
border-radius: 10px;
|
| 108 |
+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
|
| 109 |
}
|
| 110 |
|
| 111 |
+
h1, h2, h3 {
|
|
|
|
| 112 |
color: #333;
|
| 113 |
}
|
| 114 |
|
| 115 |
+
textarea {
|
| 116 |
+
font-size: 16px;
|
|
|
|
|
|
|
|
|
|
| 117 |
}
|
| 118 |
|
| 119 |
footer {
|
| 120 |
text-align: center;
|
| 121 |
color: #777;
|
| 122 |
+
margin-top: 20px;
|
|
|
|
| 123 |
}
|
| 124 |
"""
|
| 125 |
|