ruslanmv commited on
Commit
8f0882c
·
verified ·
1 Parent(s): edf1155

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +66 -1
app.py CHANGED
@@ -34,7 +34,11 @@ def askme(symptoms, question):
34
  # Extract only the assistant's response
35
  assistant_response =response_text.split("assistant")[1].strip().split("user")[0].strip()
36
  return assistant_response
37
-
 
 
 
 
38
  # Example usage
39
  symptoms = '''\
40
  I'm a 35-year-old male and for the past few months, I've been experiencing fatigue,
@@ -59,3 +63,64 @@ iface = gr.Interface(
59
  )
60
 
61
  iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  # Extract only the assistant's response
35
  assistant_response =response_text.split("assistant")[1].strip().split("user")[0].strip()
36
  return assistant_response
37
+
38
+
39
+ '''
40
+
41
+
42
  # Example usage
43
  symptoms = '''\
44
  I'm a 35-year-old male and for the past few months, I've been experiencing fatigue,
 
63
  )
64
 
65
  iface.launch()
66
+
67
+ '''
68
+
69
+
70
+ # Read CSS from file
71
+ css = """
72
+ #content_align {
73
+ text-align: center;
74
+ padding: 20px;
75
+ background-color: #282c34;
76
+ color: #fff;
77
+ font-family: Arial, sans-serif;
78
+ }
79
+ """
80
+
81
+ # The welcome message with improved styling
82
+ welcome_message = '''
83
+ <div id="content_align">
84
+ <h1>AI Medical Chatbot</h1>
85
+ <p>Ask any medical question and get answers from our AI Medical Chatbot</p>
86
+ <p>Developed by Ruslan Magana. Visit <a href="https://ruslanmv.com/">https://ruslanmv.com/</a> for more information.</p>
87
+ </div>
88
+ '''
89
+
90
+ # Creating Gradio interface with full-screen styling
91
+ iface = gr.Interface(
92
+ fn=askme,
93
+ inputs=["text", "text"],
94
+ outputs="text",
95
+ title="Medical AI Chatbot",
96
+ description="Ask me a medical question!",
97
+ layout="vertical",
98
+ css=css
99
+ )
100
+
101
+ # Display the welcome message
102
+ iface.add_text(welcome_message)
103
+
104
+ # Input elements
105
+ symptoms_input = iface.add_textbox("text", label="Symptoms", placeholder="Enter symptoms here")
106
+ question_input = iface.add_textbox("text", label="Question", placeholder="Enter question here")
107
+
108
+ # Output element
109
+ answer_output = iface.add_textbox("text", label="Answer")
110
+
111
+ # Example usage
112
+ symptoms = '''\
113
+ I'm a 35-year-old male and for the past few months, I've been experiencing fatigue,
114
+ increased sensitivity to cold, and dry, itchy skin.
115
+ '''
116
+ question = '''\
117
+ Could these symptoms be related to hypothyroidism?
118
+ If so, what steps should I take to get a proper diagnosis and discuss treatment options?
119
+ '''
120
+
121
+ examples = [
122
+ [symptoms, question]
123
+ ]
124
+
125
+ # Assuming you have a function `askme` that processes the symptoms and question and returns a response
126
+ iface.launch(examples=examples)