Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -397,9 +397,9 @@ def rag_respond(message, history):
|
|
| 397 |
"""Handle chat messages"""
|
| 398 |
if not message or not str(message).strip():
|
| 399 |
return "Please enter a question."
|
| 400 |
-
|
| 401 |
return rag_index.answer(str(message))
|
| 402 |
-
|
| 403 |
|
| 404 |
# Build interface
|
| 405 |
description = WELCOME_MSG
|
|
@@ -425,7 +425,6 @@ chat = gr.ChatInterface(
|
|
| 425 |
fn=rag_respond,
|
| 426 |
title=CONFIG["client"]["name"],
|
| 427 |
description=description,
|
| 428 |
-
type="text", # FIX: use text so `message` is a string
|
| 429 |
examples=examples if examples else None,
|
| 430 |
cache_examples=False,
|
| 431 |
retry_btn="🔄 Retry",
|
|
@@ -433,11 +432,12 @@ chat = gr.ChatInterface(
|
|
| 433 |
clear_btn="🗑️ Clear",
|
| 434 |
)
|
| 435 |
|
|
|
|
|
|
|
| 436 |
if __name__ == "__main__":
|
| 437 |
-
|
| 438 |
-
port = int(os.environ.get("PORT", 7860)) # FIX: use HF port if provided
|
| 439 |
chat.launch(
|
| 440 |
server_name="0.0.0.0",
|
| 441 |
server_port=port,
|
| 442 |
share=False,
|
| 443 |
-
)
|
|
|
|
| 397 |
"""Handle chat messages"""
|
| 398 |
if not message or not str(message).strip():
|
| 399 |
return "Please enter a question."
|
| 400 |
+
|
| 401 |
return rag_index.answer(str(message))
|
| 402 |
+
|
| 403 |
|
| 404 |
# Build interface
|
| 405 |
description = WELCOME_MSG
|
|
|
|
| 425 |
fn=rag_respond,
|
| 426 |
title=CONFIG["client"]["name"],
|
| 427 |
description=description,
|
|
|
|
| 428 |
examples=examples if examples else None,
|
| 429 |
cache_examples=False,
|
| 430 |
retry_btn="🔄 Retry",
|
|
|
|
| 432 |
clear_btn="🗑️ Clear",
|
| 433 |
)
|
| 434 |
|
| 435 |
+
|
| 436 |
+
|
| 437 |
if __name__ == "__main__":
|
| 438 |
+
port = int(os.environ.get("PORT", 7860))
|
|
|
|
| 439 |
chat.launch(
|
| 440 |
server_name="0.0.0.0",
|
| 441 |
server_port=port,
|
| 442 |
share=False,
|
| 443 |
+
)
|