Younes13 commited on
Commit
53ee217
·
verified ·
1 Parent(s): d0419b6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -22,11 +22,14 @@ def student_bot(question):
22
  best_score = cos_scores.max().item()
23
  best_idx = cos_scores.argmax().item()
24
 
25
- if best_score >= 0.65: # آستانه شباهت نسبتاً معتدل
26
- best_q = faq_questions[best_idx]
27
- return faq_dict[best_q]
28
  else:
29
- return "❗️متاسفم، پاسخ این سؤال فعلاً در سیستم ثبت نشده است."
 
 
 
30
 
31
  iface = gr.Interface(
32
  fn=student_bot,
 
22
  best_score = cos_scores.max().item()
23
  best_idx = cos_scores.argmax().item()
24
 
25
+ if best_score >= 0.7:
26
+ best_question = faq_questions[best_idx]
27
+ return faq_dict[best_question]
28
  else:
29
+ # 🧠 فراخوانی مدل زبانی fallback
30
+ response = generate_with_farsigpt(question)
31
+ return "🔍 پاسخ با مدل زبانی:\n" + response
32
+
33
 
34
  iface = gr.Interface(
35
  fn=student_bot,