Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from rag_pipeline import rag_chain # reuse from Step 3 in rag_pipeline.py
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
def chat_with_rag(message, history):
|
| 6 |
if not message.strip():
|
|
@@ -170,9 +174,6 @@ with gr.Blocks(
|
|
| 170 |
|
| 171 |
if __name__ == "__main__":
|
| 172 |
demo.launch(
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
share=False, # Set to True if you want a public link
|
| 176 |
-
debug=True, # Enable debug mode for better error messages
|
| 177 |
-
show_error=True,
|
| 178 |
)
|
|
|
|
| 1 |
+
import os
|
| 2 |
import gradio as gr
|
| 3 |
from rag_pipeline import rag_chain # reuse from Step 3 in rag_pipeline.py
|
| 4 |
|
| 5 |
+
# Check if running on Hugging Face Spaces
|
| 6 |
+
IS_HF_SPACES = os.getenv("SPACE_ID") is not None
|
| 7 |
+
|
| 8 |
|
| 9 |
def chat_with_rag(message, history):
|
| 10 |
if not message.strip():
|
|
|
|
| 174 |
|
| 175 |
if __name__ == "__main__":
|
| 176 |
demo.launch(
|
| 177 |
+
debug=False, # Disable debug mode for production
|
| 178 |
+
show_error=True, # Keep error display for users
|
|
|
|
|
|
|
|
|
|
| 179 |
)
|