Spaces:
Build error
Build error
Update app.py
Browse files
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
|
| 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,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()
|