Ahmad-01 commited on
Commit
8ee28b2
·
verified ·
1 Parent(s): 8622e0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -32,13 +32,11 @@ def bot_reply(user_query, history):
32
  if not user_query.strip():
33
  return history + [("","Please enter a valid question.")]
34
 
35
- # Encode query
36
  q_emb = model.encode([user_query], normalize_embeddings=True)
37
  sims = cosine_similarity(q_emb, corpus_embeddings)[0]
38
  idx = np.argmax(sims)
39
  best_match = df.iloc[idx]
40
 
41
- # Prepare clean response
42
  response = (
43
  f"🍽 **Recommended Restaurant**\n\n"
44
  f"**Name:** {best_match['restaurant_name']}\n"
@@ -48,15 +46,14 @@ def bot_reply(user_query, history):
48
  f"Let me know if you want more options!"
49
  )
50
 
51
- # Update chat
52
  history = history + [(user_query, response)]
53
  return history
54
 
55
 
56
  # -----------------------------
57
- # GRADIO UI (MODERN + CLEAN)
58
  # -----------------------------
59
- with gr.Blocks(theme=gr.themes.Soft(primary_hue="indigo")) as demo:
60
 
61
  gr.Markdown(
62
  """
 
32
  if not user_query.strip():
33
  return history + [("","Please enter a valid question.")]
34
 
 
35
  q_emb = model.encode([user_query], normalize_embeddings=True)
36
  sims = cosine_similarity(q_emb, corpus_embeddings)[0]
37
  idx = np.argmax(sims)
38
  best_match = df.iloc[idx]
39
 
 
40
  response = (
41
  f"🍽 **Recommended Restaurant**\n\n"
42
  f"**Name:** {best_match['restaurant_name']}\n"
 
46
  f"Let me know if you want more options!"
47
  )
48
 
 
49
  history = history + [(user_query, response)]
50
  return history
51
 
52
 
53
  # -----------------------------
54
+ # GRADIO UI (Safe Version)
55
  # -----------------------------
56
+ with gr.Blocks() as demo:
57
 
58
  gr.Markdown(
59
  """