iamfaham commited on
Commit
17de045
·
verified ·
1 Parent(s): 33b4d0a

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
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
- server_name="127.0.0.1", # Allow external access
174
- server_port=7860,
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
  )