tharunchndrn commited on
Commit
f683f28
·
verified ·
1 Parent(s): 3b9a8e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -16,13 +16,13 @@ if not (os.path.exists(FAISS_INDEX_PATH) and os.path.exists(DOCSTORE_PATH)):
16
 
17
  rag = RAGEngineHF()
18
 
19
- def respond(message, history, lang):
20
  message = (message or "").strip()
21
  if not message:
22
  return ""
23
 
24
  try:
25
- result = rag.answer(message, preferred_lang=lang)
26
  answer = (result.get("answer") or "").strip()
27
  return answer if answer else "I couldn’t find enough information to answer that. Please rephrase."
28
  except Exception:
@@ -32,11 +32,9 @@ with gr.Blocks(title=BOT_NAME) as demo:
32
  gr.Markdown(f"## {BOT_NAME}")
33
  gr.Markdown(BOT_WELCOME)
34
 
35
-
36
- # ✅ Minimal ChatInterface for maximum compatibility
37
  gr.ChatInterface(
38
- fn=respond,
39
- additional_inputs=[lang]
40
  )
41
 
42
  demo.queue()
 
16
 
17
  rag = RAGEngineHF()
18
 
19
+ def respond(message, history):
20
  message = (message or "").strip()
21
  if not message:
22
  return ""
23
 
24
  try:
25
+ result = rag.answer(message)
26
  answer = (result.get("answer") or "").strip()
27
  return answer if answer else "I couldn’t find enough information to answer that. Please rephrase."
28
  except Exception:
 
32
  gr.Markdown(f"## {BOT_NAME}")
33
  gr.Markdown(BOT_WELCOME)
34
 
35
+ # ✅ Minimal ChatInterface
 
36
  gr.ChatInterface(
37
+ fn=respond
 
38
  )
39
 
40
  demo.queue()