Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -126,11 +126,11 @@ def format_yes_responses():
|
|
126 |
|
127 |
def run_final_analysis():
|
128 |
yield (
|
129 |
-
gr.update(value="⏳ Please wait... analyzing your responses 🧠"),
|
130 |
-
gr.update(value=""),
|
131 |
-
*[gr.update(visible=False) for _ in range(
|
132 |
-
gr.update(visible=False),
|
133 |
-
gr.update(visible=False)
|
134 |
)
|
135 |
|
136 |
time.sleep(1)
|
@@ -138,29 +138,28 @@ def run_final_analysis():
|
|
138 |
yes_summary = format_yes_responses()
|
139 |
|
140 |
prompt = (
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
)
|
150 |
-
|
151 |
|
152 |
output = llm(prompt, max_new_tokens=400, temperature=0.3, do_sample=False)
|
153 |
ai_result = output[0]["generated_text"]
|
154 |
|
155 |
yield (
|
156 |
-
gr.update(value="✅ AI Analysis Completed."),
|
157 |
-
gr.update(value=""),
|
158 |
-
*[gr.update(visible=False) for _ in range(4)],
|
159 |
-
gr.update(visible=True),
|
160 |
-
gr.update(
|
161 |
-
gr.update(visible=True)
|
162 |
)
|
163 |
|
|
|
164 |
def go_back():
|
165 |
if state["index"] > 0:
|
166 |
state["index"] -= 1
|
|
|
126 |
|
127 |
def run_final_analysis():
|
128 |
yield (
|
129 |
+
gr.update(value="⏳ Please wait... analyzing your responses 🧠"), # question_display
|
130 |
+
gr.update(value=""), # progress_bar
|
131 |
+
*[gr.update(visible=False) for _ in range(4)], # yes_btn, no_btn, back_btn, result_btn
|
132 |
+
gr.update(visible=False), # result_box
|
133 |
+
gr.update(visible=False) # restart_btn
|
134 |
)
|
135 |
|
136 |
time.sleep(1)
|
|
|
138 |
yes_summary = format_yes_responses()
|
139 |
|
140 |
prompt = (
|
141 |
+
"You are a psychiatric clinical assistant. Based on the following symptoms reported by the user, "
|
142 |
+
"please provide:\n\n"
|
143 |
+
"1. A brief clinical impression (mention relevant symptom clusters like Anxiety, Depression, Psychosis, etc.).\n"
|
144 |
+
"2. Suggested next steps.\n"
|
145 |
+
"3. Hindi translation of your entire response.\n\n"
|
146 |
+
"Symptoms reported:\n"
|
147 |
+
f"{yes_summary}\n\n"
|
148 |
+
"Do not repeat this instruction. Directly provide your analysis."
|
149 |
+
)
|
|
|
150 |
|
151 |
output = llm(prompt, max_new_tokens=400, temperature=0.3, do_sample=False)
|
152 |
ai_result = output[0]["generated_text"]
|
153 |
|
154 |
yield (
|
155 |
+
gr.update(value="✅ AI Analysis Completed."), # question_display
|
156 |
+
gr.update(value=""), # progress_bar
|
157 |
+
*[gr.update(visible=False) for _ in range(4)], # yes_btn, no_btn, back_btn, result_btn
|
158 |
+
gr.update(value=ai_result, visible=True), # result_box (important: both value+visible)
|
159 |
+
gr.update(visible=True) # restart_btn
|
|
|
160 |
)
|
161 |
|
162 |
+
|
163 |
def go_back():
|
164 |
if state["index"] > 0:
|
165 |
state["index"] -= 1
|