invincible-jha commited on
Commit
cba0a6a
1 Parent(s): 06b9483

Upload 3 files

Browse files
Files changed (3) hide show
  1. README.md +57 -14
  2. app.py +70 -0
  3. requirements.txt +20 -0
README.md CHANGED
@@ -1,14 +1,57 @@
1
- ---
2
- title: Eeg Mental Health Platform
3
- emoji: 🐠
4
- colorFrom: red
5
- colorTo: yellow
6
- sdk: gradio
7
- sdk_version: 5.8.0
8
- app_file: app.py
9
- pinned: false
10
- license: mit
11
- short_description: Advanced AI powered mental health platform
12
- ---
13
-
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AI-Powered Mental Health Analysis Platform
2
+
3
+ This Hugging Face Space hosts an advanced platform that integrates EEG signal processing, AI-driven analysis, and personalized treatment planning for mental health assessment and care.
4
+
5
+ ## Features
6
+
7
+ - **EEG Signal Processing & Analysis**
8
+ - Support for common EEG file formats (EDF, BDF, CNT)
9
+ - Advanced preprocessing and feature extraction
10
+ - Real-time processing capabilities
11
+
12
+ - **Interactive Brain Mapping**
13
+ - 2D topographic mapping
14
+ - 3D surface visualization
15
+ - Connectivity network analysis
16
+
17
+ - **AI-Powered Clinical Analysis**
18
+ - Mental health assessment
19
+ - Condition probability estimation
20
+ - Severity assessment
21
+ - Risk factor identification
22
+
23
+ - **Treatment Planning**
24
+ - Personalized recommendations
25
+ - Evidence-based interventions
26
+ - Lifestyle modifications
27
+ - Crisis management plans
28
+
29
+ ## How to Use
30
+
31
+ 1. Upload your EEG data file (supported formats: EDF, BDF, CNT)
32
+ 2. Select the analysis type you want to perform
33
+ 3. View the generated visualizations and analysis results
34
+ 4. Get personalized treatment recommendations
35
+
36
+ ## Data Requirements
37
+
38
+ - Supported formats: EDF, BDF, CNT
39
+ - Minimum sampling rate: 250 Hz
40
+ - Standard 10-20 electrode placement
41
+ - Good signal quality with minimal artifacts
42
+
43
+ ## Models
44
+
45
+ The platform uses specialized models for:
46
+ - Clinical Text Analysis: BiomedNLP-PubMedBERT
47
+ - Mental Health Assessment: Custom classification models
48
+ - EEG Analysis: Deep learning models
49
+
50
+ ## Disclaimer
51
+
52
+ This platform is designed to assist healthcare professionals and should not be used as a replacement for professional medical advice, diagnosis, or treatment.
53
+
54
+ ## Credits
55
+
56
+ Created by [Your Name/Organization]
57
+ Based on research and collaboration with the scientific community.
app.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ from modules.eeg_processor import EEGProcessor
4
+ from modules.brain_mapper import BrainMapper
5
+ from modules.clinical_analyzer import ClinicalAnalyzer
6
+ from modules.treatment_planner import TreatmentPlanner
7
+
8
+ def process_eeg(file_obj):
9
+ processor = EEGProcessor()
10
+ mapper = BrainMapper()
11
+ analyzer = ClinicalAnalyzer()
12
+ planner = TreatmentPlanner()
13
+
14
+ # Process EEG data
15
+ eeg_data = processor.process_file(file_obj.name)
16
+
17
+ # Generate visualizations
18
+ brain_map = mapper.generate_topographic_map(eeg_data)
19
+ connectivity = mapper.generate_connectivity_map(eeg_data)
20
+
21
+ # Perform analysis
22
+ clinical_analysis = analyzer.analyze_eeg(eeg_data)
23
+ mental_health_assessment = analyzer.assess_mental_health(clinical_analysis)
24
+ risk_factors = analyzer.identify_risk_factors(clinical_analysis)
25
+
26
+ # Generate treatment plan
27
+ treatment_plan = planner.generate_plan(clinical_analysis, mental_health_assessment)
28
+
29
+ return {
30
+ "Brain Activity Map": brain_map,
31
+ "Brain Connectivity": connectivity,
32
+ "Clinical Analysis": clinical_analysis,
33
+ "Mental Health Assessment": mental_health_assessment,
34
+ "Risk Factors": risk_factors,
35
+ "Treatment Recommendations": treatment_plan
36
+ }
37
+
38
+ # Create Gradio interface
39
+ with gr.Blocks(title="AI-Powered Mental Health Analysis Platform") as demo:
40
+ gr.Markdown("# AI-Powered Mental Health Analysis Platform")
41
+ gr.Markdown("Upload your EEG data file for analysis and treatment recommendations.")
42
+
43
+ with gr.Row():
44
+ with gr.Column():
45
+ file_input = gr.File(label="Upload EEG Data (EDF, BDF, or CNT format)")
46
+ analyze_btn = gr.Button("Analyze")
47
+
48
+ with gr.Column():
49
+ brain_map = gr.Plot(label="Brain Activity Map")
50
+ connectivity_map = gr.Plot(label="Brain Connectivity")
51
+
52
+ with gr.Row():
53
+ with gr.Column():
54
+ clinical_output = gr.JSON(label="Clinical Analysis")
55
+ assessment_output = gr.JSON(label="Mental Health Assessment")
56
+
57
+ with gr.Column():
58
+ risk_output = gr.JSON(label="Risk Factors")
59
+ treatment_output = gr.Markdown(label="Treatment Recommendations")
60
+
61
+ analyze_btn.click(
62
+ fn=process_eeg,
63
+ inputs=[file_input],
64
+ outputs=[brain_map, connectivity_map, clinical_output,
65
+ assessment_output, risk_output, treatment_output]
66
+ )
67
+
68
+ # Launch the interface
69
+ if __name__ == "__main__":
70
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ gradio>=4.8.0
2
+ torch>=2.0.0
3
+ transformers>=4.34.0
4
+ mne>=1.5.0
5
+ numpy>=1.24.0
6
+ pandas>=2.0.0
7
+ plotly>=5.18.0
8
+ networkx>=3.1
9
+ scikit-learn>=1.3.0
10
+ xgboost>=2.0.0
11
+ nilearn>=0.10.0
12
+ scipy>=1.10.0
13
+ matplotlib>=3.7.0
14
+ seaborn>=0.12.0
15
+ huggingface-hub>=0.19.0
16
+ python-dotenv>=1.0.0
17
+ fastapi>=0.104.0
18
+ python-multipart>=0.0.6
19
+ aiohttp>=3.9.0
20
+ sqlalchemy>=2.0.0