ashishkgpian commited on
Commit
1948f3b
·
verified ·
1 Parent(s): a7ec3bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +76 -9
app.py CHANGED
@@ -34,21 +34,88 @@ def classify_symptoms(text):
34
  except Exception as e:
35
  return f"Error processing classification: {str(e)}"
36
 
37
- # Create Gradio interface
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  demo = gr.Interface(
39
  fn=classify_symptoms,
40
  inputs=gr.Textbox(
41
- label="Enter Medical Symptoms",
42
- placeholder="Describe patient symptoms here..."
 
 
 
 
 
 
 
43
  ),
44
- outputs=gr.JSON(label="Top 5 ICD9 Classifications"),
45
- title="BioBERT ICD9 Symptom Classifier",
46
- description="Classify medical symptoms into ICD9 diagnostic codes using a fine-tuned BioBERT model.",
47
  theme="huggingface",
 
48
  examples=[
49
- ["Patient experiencing chest pain and shortness of breath"],
50
- ["Recurring headaches with nausea"],
51
- ["Diabetic symptoms including frequent urination"]
 
 
 
 
 
 
 
 
 
 
 
 
52
  ]
53
  )
54
 
 
34
  except Exception as e:
35
  return f"Error processing classification: {str(e)}"
36
 
37
+ # Custom CSS for medical-themed UI
38
+ custom_css = """
39
+ /* Medical-inspired color palette and design */
40
+ .gradio-container {
41
+ background-color: #f4f7f6;
42
+ font-family: 'Arial', 'Helvetica Neue', sans-serif;
43
+ }
44
+
45
+ /* Styled input area */
46
+ .input-container {
47
+ background-color: #ffffff;
48
+ border: 2px solid #3498db;
49
+ border-radius: 10px;
50
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
51
+ padding: 15px;
52
+ }
53
+
54
+ /* Result card styling */
55
+ .result-card {
56
+ background-color: #ffffff;
57
+ border-left: 5px solid #2ecc71;
58
+ margin-bottom: 10px;
59
+ padding: 10px;
60
+ border-radius: 5px;
61
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
62
+ }
63
+
64
+ /* Medical icon-like styling for headers */
65
+ .gradio-header {
66
+ color: #2c3e50;
67
+ text-align: center;
68
+ font-weight: bold;
69
+ }
70
+
71
+ /* Soften the medical green theme */
72
+ .submit-button {
73
+ background-color: #2ecc71 !important;
74
+ color: white !important;
75
+ border: none !important;
76
+ transition: all 0.3s ease;
77
+ }
78
+
79
+ .submit-button:hover {
80
+ background-color: #27ae60 !important;
81
+ transform: scale(1.05);
82
+ }
83
+ """
84
+
85
+ # Create Gradio interface with advanced medical-themed design
86
  demo = gr.Interface(
87
  fn=classify_symptoms,
88
  inputs=gr.Textbox(
89
+ label="Patient Symptom Description",
90
+ placeholder="Enter detailed patient symptoms (e.g., 'Patient reports persistent chest pain radiating to left arm, accompanied by shortness of breath')",
91
+ lines=4,
92
+ container=False,
93
+ elem_classes=["input-container"]
94
+ ),
95
+ outputs=gr.JSON(
96
+ label="Diagnostic Suggestions",
97
+ elem_classes=["result-card"]
98
  ),
99
+ title="Symptom-to-ICD9 Classifier",
100
+ description="An advanced AI-powered diagnostic assistance tool for converting clinical symptom descriptions into potential ICD9 diagnostic codes.",
 
101
  theme="huggingface",
102
+ css=custom_css,
103
  examples=[
104
+ ["45-year-old male experiencing severe chest pain, radiating to left arm, with shortness of breath and excessive sweating"],
105
+ ["Persistent headache for 2 weeks, accompanied by dizziness and occasional blurred vision"],
106
+ ["Diabetic patient reporting frequent urination, increased thirst, and unexplained weight loss"],
107
+ ["Elderly patient with chronic knee pain, reduced mobility, and signs of inflammation"]
108
+ ]
109
+ )
110
+
111
+ # Add some footer-like information
112
+ demo.layout = gr.Column(
113
+ [
114
+ demo.title,
115
+ demo.description,
116
+ demo.input,
117
+ demo.output,
118
+ gr.Markdown("**Disclaimer:** This is an AI-assisted diagnostic tool. Always consult with a healthcare professional for accurate diagnosis and treatment.")
119
  ]
120
  )
121