walaa2022 commited on
Commit
0bee0bb
Β·
verified Β·
1 Parent(s): 1196b1e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +280 -263
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
- # You'll need to set this as an environment variable in Hugging Face Spaces
11
- GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
12
-
13
- class MedicalAssistant:
14
- def __init__(self):
15
- if not GOOGLE_API_KEY:
16
- raise ValueError("Please set GOOGLE_API_KEY environment variable")
17
-
18
- genai.configure(api_key=GOOGLE_API_KEY)
19
 
20
- # Use Gemini Pro Vision for multimodal capabilities
21
- self.model = genai.GenerativeModel('gemini-1.5-pro-latest')
 
22
 
23
- # Medical analysis prompt template
24
- self.medical_prompt_template = """
25
- You are an expert medical AI assistant with comprehensive training in medical imaging, diagnostics, and clinical decision support. Your analysis should be thorough, evidence-based, and clinically relevant.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  **IMPORTANT DISCLAIMERS:**
28
- - This analysis is for educational and assistive purposes only
29
- - It does not replace professional medical consultation
30
- - All findings should be verified by qualified healthcare providers
31
  - Emergency cases require immediate medical attention
32
 
33
- **PATIENT INFORMATION:**
34
- {patient_info}
35
-
36
- **CHIEF COMPLAINTS:**
37
- {complaints}
38
-
39
- **MEDICAL IMAGES PROVIDED:**
40
- {image_count} image(s) uploaded for analysis
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
 
42
- **TASK:**
43
- Please provide a comprehensive medical analysis including:
44
 
45
- 1. **IMAGE ANALYSIS** (if images provided):
46
- - Systematic description of visible findings
47
- - Anatomical structures identified
48
- - Any abnormalities, lesions, or pathological changes
49
- - Image quality and limitations assessment
50
 
51
- 2. **CLINICAL CORRELATION:**
52
- - How imaging findings relate to patient symptoms
53
- - Differential diagnoses based on presentation
54
- - Risk factors and red flags identified
55
 
56
- 3. **DIFFERENTIAL DIAGNOSES:**
57
- - List 3-5 most likely diagnoses with reasoning
58
- - Include probability assessment if possible
59
- - Consider both common and critical conditions
 
60
 
61
- 4. **RECOMMENDED INVESTIGATIONS:**
62
- - Additional imaging studies if needed
63
- - Laboratory tests to consider
64
- - Specialist consultations advised
65
 
66
- 5. **IMMEDIATE CONCERNS:**
67
- - Any findings requiring urgent attention
68
- - Red flags or emergency indicators
 
 
69
 
70
- 6. **MANAGEMENT SUGGESTIONS:**
71
- - Initial treatment considerations
72
- - Follow-up recommendations
73
- - Patient education points
74
 
75
- 7. **LIMITATIONS & CONSIDERATIONS:**
76
- - Limitations of the current analysis
77
- - Information gaps that need addressing
78
- - Quality of provided data
79
 
80
- Please structure your response clearly with appropriate medical terminology while ensuring it's understandable. Use evidence-based medicine principles and cite relevant clinical guidelines where applicable.
81
 
82
- Remember to maintain a professional, empathetic tone and emphasize the importance of professional medical consultation for definitive diagnosis and treatment.
83
- """
84
 
85
- def format_patient_info(self, age, gender, medical_history, current_medications, allergies, vital_signs):
86
- """Format patient information for the prompt"""
87
- info = []
88
- if age:
89
- info.append(f"Age: {age}")
90
- if gender:
91
- info.append(f"Gender: {gender}")
92
- if medical_history:
93
- info.append(f"Medical History: {medical_history}")
94
- if current_medications:
95
- info.append(f"Current Medications: {current_medications}")
96
- if allergies:
97
- info.append(f"Allergies: {allergies}")
98
- if vital_signs:
99
- info.append(f"Vital Signs: {vital_signs}")
 
 
 
 
100
 
101
- return "\n".join(info) if info else "No patient information provided"
102
-
103
- def analyze_medical_case(self, images, age, gender, medical_history,
104
- current_medications, allergies, vital_signs, complaints):
105
- """Analyze medical case with Gemini"""
106
- try:
107
- # Format patient information
108
- patient_info = self.format_patient_info(
109
- age, gender, medical_history, current_medications,
110
- allergies, vital_signs
111
- )
112
-
113
- # Prepare the prompt
114
- prompt = self.medical_prompt_template.format(
115
- patient_info=patient_info,
116
- complaints=complaints if complaints else "No specific complaints provided",
117
- image_count=len(images) if images else 0
118
- )
119
-
120
- # Prepare content for Gemini
121
- content = [prompt]
122
-
123
- # Add images if provided
124
- if images:
125
- for img_path in images:
126
- try:
127
- img = Image.open(img_path)
128
- content.append(img)
129
- except Exception as e:
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
- # Initialize the assistant
150
- assistant = MedicalAssistant()
151
 
152
- # Create Gradio interface
153
- def process_medical_case(images, age, gender, medical_history,
154
- current_medications, allergies, vital_signs, complaints):
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
- image_paths = [images.name if hasattr(images, 'name') else images]
168
-
169
- # Run analysis
170
- result = assistant.analyze_medical_case(
171
- image_paths, age, gender, medical_history,
172
- current_medications, allergies, vital_signs, complaints
173
- )
174
-
175
- return result
176
 
177
- # Create Gradio interface
178
- with gr.Blocks(theme=gr.themes.Soft()) as demo:
179
- gr.Markdown(
180
- """
181
- # πŸ₯ Medical AI Assistant powered by Gemini
182
 
183
- This AI assistant analyzes medical images and patient data to provide clinical insights.
184
- Upload medical images and enter patient information for comprehensive analysis.
185
 
186
- **Note**: Ensure you have set the GOOGLE_API_KEY environment variable in your Hugging Face Space settings.
187
- """
188
- )
189
-
190
- with gr.Row():
191
- with gr.Column(scale=1):
192
- gr.Markdown("### πŸ“‹ Patient Information")
193
- age = gr.Number(label="Age", precision=0)
194
- gender = gr.Dropdown(
195
- label="Gender",
196
- choices=["Male", "Female", "Other", "Prefer not to say"],
197
- value="Prefer not to say"
198
- )
199
- medical_history = gr.Textbox(
200
- label="Medical History",
201
- placeholder="Previous diagnoses, surgeries, chronic conditions...",
202
- lines=3
203
- )
204
- current_medications = gr.Textbox(
205
- label="Current Medications",
206
- placeholder="List all current medications and dosages...",
207
- lines=2
208
- )
209
- allergies = gr.Textbox(
210
- label="Allergies",
211
- placeholder="Drug allergies, food allergies, etc...",
212
- lines=2
213
- )
214
- vital_signs = gr.Textbox(
215
- label="Vital Signs",
216
- placeholder="BP: 120/80, HR: 72, Temp: 98.6Β°F, etc...",
217
- lines=2
218
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
 
220
- with gr.Column(scale=1):
221
- gr.Markdown("### πŸ₯ Clinical Data")
222
- complaints = gr.Textbox(
223
- label="Chief Complaints & Symptoms",
224
- placeholder="Describe main symptoms, duration, severity, associated factors...",
225
- lines=6
226
- )
227
- images = gr.File(
228
- label="Medical Images",
229
- file_count="multiple",
230
- file_types=["image"],
231
- type="filepath"
232
- )
233
- gr.Markdown(
234
- """
235
- **Supported formats**: X-rays, CT scans, MRI, ultrasound, clinical photos
236
 
237
- **Privacy Note**: Ensure all images are properly anonymized
238
- """
239
- )
240
-
241
- submit_btn = gr.Button("πŸ”¬ Analyze Case", variant="primary", size="lg")
242
-
243
- output = gr.Markdown(label="Analysis Results")
244
-
245
- # Examples
246
- gr.Examples(
247
- examples=[
248
- [
249
- None, # images
250
- 45, # age
251
- "Male", # gender
252
- "Hypertension for 5 years, Type 2 diabetes", # medical history
253
- "Metformin 500mg BD, Amlodipine 5mg OD", # medications
254
- "None known", # allergies
255
- "BP: 140/90, HR: 78, RR: 16", # vital signs
256
- "Chest pain for 2 days, radiating to left arm, associated with shortness of breath" # complaints
 
 
 
 
 
 
257
  ],
258
- [
259
- None,
260
- 28,
261
- "Female",
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
- ### βš•οΈ Important Information:
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
- ### πŸ”§ Setup Instructions for Hugging Face:
290
- 1. Create a Space on Hugging Face
291
- 2. Add your Google API key as a secret: GOOGLE_API_KEY
292
- 3. Install requirements: `google-generativeai gradio pillow`
293
- 4. Deploy this code
294
- """
295
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
- # Launch the app
298
  if __name__ == "__main__":
299
- demo.launch()
 
 
 
 
 
 
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
+ )