Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,299 +1,316 @@
|
|
1 |
import gradio as gr
|
2 |
import google.generativeai as genai
|
3 |
from PIL import Image
|
|
|
|
|
|
|
4 |
import json
|
5 |
-
from typing import List, Dict, Any
|
6 |
-
import os
|
7 |
-
from datetime import datetime
|
8 |
|
9 |
-
# Configure Gemini API
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
raise ValueError("Please set GOOGLE_API_KEY environment variable")
|
17 |
-
|
18 |
-
genai.configure(api_key=GOOGLE_API_KEY)
|
19 |
|
20 |
-
#
|
21 |
-
|
|
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
**IMPORTANT DISCLAIMERS:**
|
28 |
-
- This
|
29 |
-
-
|
30 |
-
-
|
31 |
- Emergency cases require immediate medical attention
|
32 |
|
33 |
-
**PATIENT INFORMATION:**
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
{
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
-
**
|
43 |
-
Please provide a comprehensive medical analysis including:
|
44 |
|
45 |
-
1.
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
- Image quality and limitations assessment
|
50 |
|
51 |
-
2.
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
|
56 |
-
3.
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
60 |
|
61 |
-
4.
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
|
66 |
-
5.
|
67 |
-
|
68 |
-
|
|
|
|
|
69 |
|
70 |
-
6.
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
|
75 |
-
7.
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
|
80 |
-
|
81 |
|
82 |
-
|
83 |
-
"""
|
84 |
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
|
|
|
|
|
|
|
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
return f"Error loading image {img_path}: {str(e)}"
|
131 |
-
|
132 |
-
# Generate response
|
133 |
-
response = self.model.generate_content(content)
|
134 |
-
|
135 |
-
# Add timestamp and disclaimer
|
136 |
-
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
137 |
-
output = f"**Analysis Generated on: {timestamp}**\n\n"
|
138 |
-
output += "β οΈ **MEDICAL DISCLAIMER**: This is an AI-generated analysis for educational purposes only. "
|
139 |
-
output += "It is not a substitute for professional medical advice, diagnosis, or treatment. "
|
140 |
-
output += "Always seek the advice of qualified healthcare providers.\n\n"
|
141 |
-
output += "---\n\n"
|
142 |
-
output += response.text
|
143 |
-
|
144 |
-
return output
|
145 |
-
|
146 |
-
except Exception as e:
|
147 |
-
return f"Error during analysis: {str(e)}\n\nPlease check your API key and inputs."
|
148 |
|
149 |
-
|
150 |
-
assistant = MedicalAssistant()
|
151 |
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
"""Process medical case through Gradio interface"""
|
156 |
-
|
157 |
-
# Validate inputs
|
158 |
-
if not complaints and not images:
|
159 |
-
return "Please provide either medical images or patient complaints for analysis."
|
160 |
-
|
161 |
-
# Get image paths if images uploaded
|
162 |
-
image_paths = []
|
163 |
-
if images:
|
164 |
-
if isinstance(images, list):
|
165 |
-
image_paths = [img.name if hasattr(img, 'name') else img for img in images]
|
166 |
else:
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
image_paths, age, gender, medical_history,
|
172 |
-
current_medications, allergies, vital_signs, complaints
|
173 |
-
)
|
174 |
-
|
175 |
-
return result
|
176 |
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
# π₯ Medical AI Assistant powered by Gemini
|
182 |
|
183 |
-
|
184 |
-
|
185 |
|
186 |
-
**
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
257 |
],
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
"Migraine headaches",
|
263 |
-
"None",
|
264 |
-
"Penicillin - rash",
|
265 |
-
"BP: 110/70, HR: 68",
|
266 |
-
"Severe headache, photophobia, nausea for 6 hours"
|
267 |
-
]
|
268 |
-
],
|
269 |
-
inputs=[images, age, gender, medical_history, current_medications,
|
270 |
-
allergies, vital_signs, complaints]
|
271 |
-
)
|
272 |
-
|
273 |
-
submit_btn.click(
|
274 |
-
fn=process_medical_case,
|
275 |
-
inputs=[images, age, gender, medical_history, current_medications,
|
276 |
-
allergies, vital_signs, complaints],
|
277 |
-
outputs=output
|
278 |
-
)
|
279 |
-
|
280 |
-
gr.Markdown(
|
281 |
-
"""
|
282 |
---
|
283 |
-
###
|
284 |
-
- This tool is for educational and assistive purposes only
|
285 |
-
- Always consult qualified healthcare professionals for medical decisions
|
286 |
-
- Ensure patient privacy and HIPAA compliance when using this tool
|
287 |
-
- Report any issues or feedback to improve the system
|
288 |
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
296 |
|
297 |
-
#
|
298 |
if __name__ == "__main__":
|
299 |
-
demo
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import google.generativeai as genai
|
3 |
from PIL import Image
|
4 |
+
import io
|
5 |
+
import base64
|
6 |
+
from typing import Optional, List, Tuple
|
7 |
import json
|
|
|
|
|
|
|
8 |
|
9 |
+
# Configure Gemini API using HuggingFace secrets
|
10 |
+
def setup_gemini():
|
11 |
+
"""Setup Gemini API with HuggingFace secrets"""
|
12 |
+
try:
|
13 |
+
# Access API key from HuggingFace secrets
|
14 |
+
import os
|
15 |
+
api_key = None
|
|
|
|
|
|
|
16 |
|
17 |
+
# Try multiple ways to access the secret
|
18 |
+
if hasattr(gr, 'secrets'):
|
19 |
+
api_key = gr.secrets.get("GEMINI_API_KEY")
|
20 |
|
21 |
+
if not api_key:
|
22 |
+
# Fallback to environment variable for local testing
|
23 |
+
api_key = os.getenv("GEMINI_API_KEY")
|
24 |
+
|
25 |
+
if not api_key:
|
26 |
+
raise ValueError("GEMINI_API_KEY not found in secrets")
|
27 |
+
|
28 |
+
genai.configure(api_key=api_key)
|
29 |
+
return genai.GenerativeModel('gemini-1.5-pro')
|
30 |
+
except Exception as e:
|
31 |
+
print(f"Error setting up Gemini: {e}")
|
32 |
+
return None
|
33 |
+
|
34 |
+
def create_medical_prompt(patient_data: dict, complaints: str, has_image: bool = False) -> str:
|
35 |
+
"""Create an optimized prompt for Gemini's medical analysis"""
|
36 |
+
|
37 |
+
base_prompt = """You are an expert medical AI assistant with extensive training in medical imaging, diagnostics, and clinical decision support. Please provide a comprehensive medical analysis based on the provided information.
|
38 |
|
39 |
**IMPORTANT DISCLAIMERS:**
|
40 |
+
- This is for educational and decision support purposes only
|
41 |
+
- Always requires human physician review and validation
|
42 |
+
- Not a substitute for professional medical judgment
|
43 |
- Emergency cases require immediate medical attention
|
44 |
|
45 |
+
**PATIENT INFORMATION:**"""
|
46 |
+
|
47 |
+
# Add patient demographics
|
48 |
+
if patient_data.get('age'):
|
49 |
+
base_prompt += f"\n- Age: {patient_data['age']} years"
|
50 |
+
if patient_data.get('gender'):
|
51 |
+
base_prompt += f"\n- Gender: {patient_data['gender']}"
|
52 |
+
if patient_data.get('weight'):
|
53 |
+
base_prompt += f"\n- Weight: {patient_data['weight']} kg"
|
54 |
+
if patient_data.get('height'):
|
55 |
+
base_prompt += f"\n- Height: {patient_data['height']} cm"
|
56 |
+
|
57 |
+
# Add medical history
|
58 |
+
if patient_data.get('medical_history'):
|
59 |
+
base_prompt += f"\n- Medical History: {patient_data['medical_history']}"
|
60 |
+
if patient_data.get('medications'):
|
61 |
+
base_prompt += f"\n- Current Medications: {patient_data['medications']}"
|
62 |
+
if patient_data.get('allergies'):
|
63 |
+
base_prompt += f"\n- Allergies: {patient_data['allergies']}"
|
64 |
+
|
65 |
+
# Add chief complaints
|
66 |
+
base_prompt += f"\n\n**CHIEF COMPLAINTS AND SYMPTOMS:**\n{complaints}"
|
67 |
+
|
68 |
+
# Add image analysis instruction if image is provided
|
69 |
+
if has_image:
|
70 |
+
base_prompt += "\n\n**MEDICAL IMAGE ANALYSIS:**\nPlease analyze the provided medical image(s) in detail, describing all visible findings, abnormalities, and relevant anatomical structures."
|
71 |
+
|
72 |
+
# Analysis framework
|
73 |
+
base_prompt += """
|
74 |
|
75 |
+
**PLEASE PROVIDE YOUR ANALYSIS IN THE FOLLOWING STRUCTURED FORMAT:**
|
|
|
76 |
|
77 |
+
## 1. CLINICAL ASSESSMENT
|
78 |
+
- **Primary Findings:** [Key observations from history and/or imaging]
|
79 |
+
- **Vital Signs Assessment:** [If provided, comment on vital signs]
|
80 |
+
- **Physical Examination Notes:** [Relevant physical findings mentioned]
|
|
|
81 |
|
82 |
+
## 2. DIFFERENTIAL DIAGNOSIS
|
83 |
+
- **Most Likely Diagnosis:** [Primary consideration with reasoning]
|
84 |
+
- **Alternative Diagnoses:** [Other possibilities to consider]
|
85 |
+
- **Ruling Out:** [Important conditions to exclude]
|
86 |
|
87 |
+
## 3. IMAGING ANALYSIS (if applicable)
|
88 |
+
- **Technical Quality:** [Assessment of image quality]
|
89 |
+
- **Anatomical Structures:** [Normal structures identified]
|
90 |
+
- **Abnormal Findings:** [Any pathological changes]
|
91 |
+
- **Measurements:** [Relevant measurements if applicable]
|
92 |
|
93 |
+
## 4. RECOMMENDED INVESTIGATIONS
|
94 |
+
- **Laboratory Tests:** [Suggested blood work, cultures, etc.]
|
95 |
+
- **Imaging Studies:** [Additional imaging if needed]
|
96 |
+
- **Specialized Tests:** [ECG, spirometry, biopsy, etc.]
|
97 |
|
98 |
+
## 5. TREATMENT RECOMMENDATIONS
|
99 |
+
- **Immediate Management:** [Urgent interventions if needed]
|
100 |
+
- **Medication Suggestions:** [Pharmacological interventions]
|
101 |
+
- **Non-Pharmacological:** [Lifestyle, physical therapy, etc.]
|
102 |
+
- **Follow-up:** [Monitoring and reassessment timeline]
|
103 |
|
104 |
+
## 6. RED FLAGS & URGENCY
|
105 |
+
- **Emergency Indicators:** [Signs requiring immediate attention]
|
106 |
+
- **Warning Signs:** [Symptoms to monitor]
|
107 |
+
- **When to Seek Help:** [Clear escalation criteria]
|
108 |
|
109 |
+
## 7. PATIENT EDUCATION
|
110 |
+
- **Condition Explanation:** [Simple explanation of likely diagnosis]
|
111 |
+
- **Lifestyle Modifications:** [Relevant lifestyle advice]
|
112 |
+
- **Prognosis:** [Expected outcome with treatment]
|
113 |
|
114 |
+
**Remember:** This analysis is for educational and decision support purposes. Always correlate with clinical judgment and seek appropriate medical consultation."""
|
115 |
|
116 |
+
return base_prompt
|
|
|
117 |
|
118 |
+
def analyze_medical_case(image_files, age, gender, weight, height, medical_history,
|
119 |
+
medications, allergies, complaints):
|
120 |
+
"""Analyze medical case using Gemini AI"""
|
121 |
+
|
122 |
+
model = setup_gemini()
|
123 |
+
if not model:
|
124 |
+
return "β Error: Could not initialize Gemini AI. Please check API key in secrets."
|
125 |
+
|
126 |
+
try:
|
127 |
+
# Prepare patient data
|
128 |
+
patient_data = {
|
129 |
+
'age': age,
|
130 |
+
'gender': gender,
|
131 |
+
'weight': weight,
|
132 |
+
'height': height,
|
133 |
+
'medical_history': medical_history,
|
134 |
+
'medications': medications,
|
135 |
+
'allergies': allergies
|
136 |
+
}
|
137 |
|
138 |
+
# Validate input
|
139 |
+
if not complaints.strip():
|
140 |
+
return "β Please provide patient complaints and symptoms."
|
141 |
+
|
142 |
+
# Create prompt
|
143 |
+
has_images = image_files is not None and len(image_files) > 0
|
144 |
+
prompt = create_medical_prompt(patient_data, complaints, has_images)
|
145 |
+
|
146 |
+
# Prepare content for Gemini
|
147 |
+
content = [prompt]
|
148 |
+
|
149 |
+
# Process images if provided
|
150 |
+
if has_images:
|
151 |
+
for img_file in image_files:
|
152 |
+
try:
|
153 |
+
# Open and process image
|
154 |
+
image = Image.open(img_file.name)
|
155 |
+
# Convert to RGB if necessary
|
156 |
+
if image.mode != 'RGB':
|
157 |
+
image = image.convert('RGB')
|
158 |
+
content.append(image)
|
159 |
+
except Exception as e:
|
160 |
+
return f"β Error processing image: {str(e)}"
|
161 |
+
|
162 |
+
# Generate response
|
163 |
+
response = model.generate_content(content)
|
164 |
+
|
165 |
+
if response.text:
|
166 |
+
return f"""# π₯ Medical AI Analysis Report
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
|
168 |
+
{response.text}
|
|
|
169 |
|
170 |
+
---
|
171 |
+
**β οΈ IMPORTANT MEDICAL DISCLAIMER:**
|
172 |
+
This AI analysis is for educational and decision support purposes only. It should not replace professional medical judgment, clinical examination, or established medical protocols. Always consult with qualified healthcare professionals for medical decisions. In emergency situations, seek immediate medical attention."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
else:
|
174 |
+
return "β Could not generate analysis. Please try again."
|
175 |
+
|
176 |
+
except Exception as e:
|
177 |
+
return f"β Error during analysis: {str(e)}"
|
|
|
|
|
|
|
|
|
|
|
178 |
|
179 |
+
def create_interface():
|
180 |
+
"""Create Gradio interface for the medical assistant"""
|
181 |
+
|
182 |
+
with gr.Blocks(title="π₯ Medical AI Assistant", theme=gr.themes.Soft()) as interface:
|
|
|
183 |
|
184 |
+
gr.Markdown("""
|
185 |
+
# π₯ Medical AI Assistant with Gemini
|
186 |
|
187 |
+
**Advanced Medical Case Analysis and Decision Support**
|
188 |
+
|
189 |
+
Upload medical images, enter patient data, and get comprehensive AI-powered medical insights using Google's Gemini AI, specially trained on medical data and imaging.
|
190 |
+
|
191 |
+
β οΈ **For Healthcare Professionals Only** - This tool is designed for medical professionals and should not replace clinical judgment.
|
192 |
+
""")
|
193 |
+
|
194 |
+
with gr.Row():
|
195 |
+
with gr.Column(scale=1):
|
196 |
+
gr.Markdown("### π Medical Images")
|
197 |
+
image_files = gr.File(
|
198 |
+
label="Upload Medical Images",
|
199 |
+
file_types=[".jpg", ".jpeg", ".png", ".bmp", ".tiff"],
|
200 |
+
file_count="multiple",
|
201 |
+
height=200
|
202 |
+
)
|
203 |
+
|
204 |
+
gr.Markdown("### π€ Patient Demographics")
|
205 |
+
with gr.Row():
|
206 |
+
age = gr.Number(label="Age (years)", value=None, minimum=0, maximum=120)
|
207 |
+
gender = gr.Dropdown(
|
208 |
+
label="Gender",
|
209 |
+
choices=["Male", "Female", "Other", "Prefer not to say"],
|
210 |
+
value=None
|
211 |
+
)
|
212 |
+
|
213 |
+
with gr.Row():
|
214 |
+
weight = gr.Number(label="Weight (kg)", value=None, minimum=0)
|
215 |
+
height = gr.Number(label="Height (cm)", value=None, minimum=0)
|
216 |
+
|
217 |
+
gr.Markdown("### π Medical History")
|
218 |
+
medical_history = gr.Textbox(
|
219 |
+
label="Past Medical History",
|
220 |
+
placeholder="Previous diagnoses, surgeries, chronic conditions...",
|
221 |
+
lines=3
|
222 |
+
)
|
223 |
+
|
224 |
+
medications = gr.Textbox(
|
225 |
+
label="Current Medications",
|
226 |
+
placeholder="List current medications, dosages, frequency...",
|
227 |
+
lines=2
|
228 |
+
)
|
229 |
+
|
230 |
+
allergies = gr.Textbox(
|
231 |
+
label="Known Allergies",
|
232 |
+
placeholder="Drug allergies, food allergies, environmental...",
|
233 |
+
lines=2
|
234 |
+
)
|
235 |
|
236 |
+
with gr.Column(scale=1):
|
237 |
+
gr.Markdown("### π©Ί Chief Complaints & Symptoms")
|
238 |
+
complaints = gr.Textbox(
|
239 |
+
label="Patient Complaints and Symptoms",
|
240 |
+
placeholder="""Describe the patient's main complaints, symptoms, and clinical presentation:
|
241 |
+
|
242 |
+
β’ Chief complaint and duration
|
243 |
+
β’ Associated symptoms
|
244 |
+
β’ Severity and progression
|
245 |
+
β’ Triggering factors
|
246 |
+
β’ Previous treatments tried
|
247 |
+
β’ Vital signs (if available)
|
248 |
+
β’ Physical examination findings
|
249 |
+
β’ Any relevant recent changes""",
|
250 |
+
lines=12
|
251 |
+
)
|
252 |
|
253 |
+
analyze_btn = gr.Button(
|
254 |
+
"π Analyze Medical Case",
|
255 |
+
variant="primary",
|
256 |
+
size="lg"
|
257 |
+
)
|
258 |
+
|
259 |
+
gr.Markdown("### π AI Medical Analysis")
|
260 |
+
output = gr.Markdown(label="Analysis Results")
|
261 |
+
|
262 |
+
# Examples section
|
263 |
+
gr.Markdown("""
|
264 |
+
### π‘ Example Use Cases
|
265 |
+
|
266 |
+
**Radiology:** Upload X-rays, CT scans, MRIs for detailed imaging analysis
|
267 |
+
**Dermatology:** Skin lesion photos with patient history
|
268 |
+
**Cardiology:** ECGs, echocardiogram images with cardiac symptoms
|
269 |
+
**Pathology:** Microscopic images with clinical context
|
270 |
+
**Emergency Medicine:** Multi-modal case analysis with urgency assessment
|
271 |
+
""")
|
272 |
+
|
273 |
+
# Set up the analysis function
|
274 |
+
analyze_btn.click(
|
275 |
+
fn=analyze_medical_case,
|
276 |
+
inputs=[
|
277 |
+
image_files, age, gender, weight, height,
|
278 |
+
medical_history, medications, allergies, complaints
|
279 |
],
|
280 |
+
outputs=output
|
281 |
+
)
|
282 |
+
|
283 |
+
gr.Markdown("""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
284 |
---
|
285 |
+
### π§ Setup Instructions for HuggingFace Deployment
|
|
|
|
|
|
|
|
|
286 |
|
287 |
+
1. **Add API Key to Secrets:**
|
288 |
+
- Go to your HuggingFace Space settings
|
289 |
+
- Add a new secret: `GEMINI_API_KEY` = `your_gemini_api_key`
|
290 |
+
- Get your API key from: https://makersuite.google.com/app/apikey
|
291 |
+
|
292 |
+
2. **Required Dependencies (requirements.txt):**
|
293 |
+
```
|
294 |
+
gradio
|
295 |
+
google-generativeai
|
296 |
+
Pillow
|
297 |
+
```
|
298 |
+
|
299 |
+
### β οΈ Important Medical Disclaimers
|
300 |
+
- This AI assistant is for educational and decision support purposes only
|
301 |
+
- Always requires validation by qualified healthcare professionals
|
302 |
+
- Not a substitute for clinical examination and medical judgment
|
303 |
+
- Emergency cases require immediate medical attention
|
304 |
+
- Users assume responsibility for clinical decisions
|
305 |
+
""")
|
306 |
+
|
307 |
+
return interface
|
308 |
|
309 |
+
# Create and launch the interface
|
310 |
if __name__ == "__main__":
|
311 |
+
demo = create_interface()
|
312 |
+
demo.launch(
|
313 |
+
share=True,
|
314 |
+
server_name="0.0.0.0",
|
315 |
+
server_port=7860
|
316 |
+
)
|