Shirjannn commited on
Commit
2758b64
·
verified ·
1 Parent(s): 920fddf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -16
app.py CHANGED
@@ -137,7 +137,7 @@ def analyze_text(text):
137
  best_match = quote
138
 
139
  semantic_plot = create_semantic_plot(user_vec, best_school)
140
- profile = school_profiles[best_school]["profile"]
141
  timeline = school_profiles[best_school]["timeline"]
142
 
143
  # روانشناسی
@@ -149,7 +149,7 @@ def analyze_text(text):
149
  else:
150
  psych_output = "No clear psychological indicators found."
151
 
152
- return best_school, f"{best_score:.2f}", profile, timeline, best_match, semantic_plot, psych_output
153
 
154
 
155
  with gr.Blocks(title="Philosophical Analyzer") as demo:
@@ -160,24 +160,25 @@ with gr.Blocks(title="Philosophical Analyzer") as demo:
160
 
161
  with gr.Row():
162
  with gr.Column():
163
- gr.Markdown("### 🧠 Philosophical School Detected:")
164
- school = gr.Textbox()
165
 
166
- gr.Markdown("### 📈 Similarity Score:")
167
- score = gr.Textbox()
168
 
169
- gr.Markdown("### 🧬 Psychological Profile:")
170
- psych_box = gr.Textbox() # نام جدید برای جلوگیری از تداخل
171
 
172
- gr.Markdown("### 🕰️ Philosophy Timeline")
173
- timeline = gr.Textbox()
174
 
175
- with gr.Accordion("🧾 Most Similar Reference Quote", open=False):
176
- best_quote = gr.Textbox()
177
 
178
- # تغییر در کلیک باتن
179
- submit_btn.click(fn=analyze_text, inputs=input_text,
180
- outputs=[school, score, profile, timeline, best_quote, conceptual_map, psych_box])
 
 
181
 
182
-
183
  demo.launch()
 
137
  best_match = quote
138
 
139
  semantic_plot = create_semantic_plot(user_vec, best_school)
140
+ school_profile = school_profiles[best_school]["profile"]
141
  timeline = school_profiles[best_school]["timeline"]
142
 
143
  # روانشناسی
 
149
  else:
150
  psych_output = "No clear psychological indicators found."
151
 
152
+ return best_school, f"{best_score:.2f}", school_profile, timeline, best_match, semantic_plot, psych_output
153
 
154
 
155
  with gr.Blocks(title="Philosophical Analyzer") as demo:
 
160
 
161
  with gr.Row():
162
  with gr.Column():
163
+ gr.Markdown("### 🧠 Philosophical School Detected:")
164
+ school = gr.Textbox()
165
 
166
+ gr.Markdown("### 📈 Similarity Score:")
167
+ score = gr.Textbox()
168
 
169
+ gr.Markdown("### 🧬 Psychological Profile:")
170
+ psych_box = gr.Textbox()
171
 
172
+ gr.Markdown("### 🕰️ Philosophy Timeline")
173
+ timeline = gr.Textbox()
174
 
175
+ with gr.Accordion("🧾 Most Similar Reference Quote", open=False):
176
+ best_quote = gr.Textbox()
177
 
178
+ with gr.Column():
179
+ conceptual_map = gr.Plot(label="🧭 Conceptual Map")
180
+
181
+ submit_btn.click(fn=analyze_text, inputs=input_text,
182
+ outputs=[school, score, psych_box, timeline, best_quote, conceptual_map, psych_box])
183
 
 
184
  demo.launch()