Venkat V commited on
Commit
05491c9
·
1 Parent(s): 12207cd

updated patch

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -26,6 +26,12 @@ ocr_engine = st.selectbox("Select OCR Engine", ["easyocr", "doctr"], index=0,
26
  uploaded_file = st.file_uploader("Upload a flowchart image", type=["png", "jpg", "jpeg"])
27
 
28
  # Backend API URL (defaults to localhost for dev)
 
 
 
 
 
 
29
  #API_URL = os.getenv("API_URL", "http://localhost:7860/process-image")
30
  API_URL = os.getenv("API_URL", "/process-image")
31
  if uploaded_file:
 
26
  uploaded_file = st.file_uploader("Upload a flowchart image", type=["png", "jpg", "jpeg"])
27
 
28
  # Backend API URL (defaults to localhost for dev)
29
+
30
+
31
+ IS_SPACE = "SPACE_ID" in os.environ # Hugging Face injects this env var
32
+
33
+ API_URL = "/process-image" if IS_SPACE else os.getenv("API_URL", "http://localhost:7860/process-image")
34
+
35
  #API_URL = os.getenv("API_URL", "http://localhost:7860/process-image")
36
  API_URL = os.getenv("API_URL", "/process-image")
37
  if uploaded_file: