Shirjannn commited on
Commit
f67fc08
·
verified ·
1 Parent(s): b37ce1b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -168,7 +168,7 @@ def create_semantic_plot(user_vec, best_school):
168
  # ------------------------
169
  def analyze_text(text):
170
  if not text.strip():
171
- return "Please enter a philosophical text.", "", "", "", "", None, ""
172
 
173
  user_vec = model.encode([text])[0]
174
  best_school, best_score, best_match = None, -1, ""
@@ -188,7 +188,7 @@ def analyze_text(text):
188
  return best_school, f"{best_score:.2f}", school_profile, timeline, best_match, semantic_plot, psych_output
189
 
190
  def clear_fields():
191
- return "", "", "", "", "", "", None, ""
192
 
193
  # ------------------------
194
  # رابط Gradio
@@ -214,7 +214,10 @@ with gr.Blocks(title="Philosophical Analyzer") as demo:
214
  conceptual_map = gr.Plot(label="🧭 Conceptual Map")
215
 
216
  submit_btn.click(analyze_text, inputs=input_text,
217
- outputs=[school, score, profile_box, timeline, best_quote, conceptual_map, psych_box])
218
- clear_btn.click(clear_fields, outputs=[input_text, school, score, profile_box, timeline, best_quote, conceptual_map, psych_box])
 
 
 
219
 
220
  demo.launch()
 
168
  # ------------------------
169
  def analyze_text(text):
170
  if not text.strip():
171
+ return "", "", "", "", "", None, ""
172
 
173
  user_vec = model.encode([text])[0]
174
  best_school, best_score, best_match = None, -1, ""
 
188
  return best_school, f"{best_score:.2f}", school_profile, timeline, best_match, semantic_plot, psych_output
189
 
190
  def clear_fields():
191
+ return "", "", "", "", "", None, ""
192
 
193
  # ------------------------
194
  # رابط Gradio
 
214
  conceptual_map = gr.Plot(label="🧭 Conceptual Map")
215
 
216
  submit_btn.click(analyze_text, inputs=input_text,
217
+ outputs=[school, score, profile_box, timeline, best_quote, conceptual_map, psych_box])
218
+
219
+ clear_btn.click(clear_fields,
220
+ outputs=[school, score, profile_box, timeline, best_quote, conceptual_map, psych_box])
221
+
222
 
223
  demo.launch()