jebin511 commited on
Commit
c5eb010
·
verified ·
1 Parent(s): e1678bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -77,5 +77,12 @@ def api_predict(payload: dict):
77
  seq = payload.get("sequence", "")
78
  return predict_sequence(seq)
79
 
 
80
  if __name__ == "__main__":
81
- demo.launch()
 
 
 
 
 
 
 
77
  seq = payload.get("sequence", "")
78
  return predict_sequence(seq)
79
 
80
+ # --- Launch ---
81
  if __name__ == "__main__":
82
+ # Detect if running on Hugging Face Spaces
83
+ on_spaces = os.environ.get("SPACE_ID") is not None
84
+ demo.launch(
85
+ share=not on_spaces, # Creates public URL if local
86
+ server_name="0.0.0.0",
87
+ server_port=int(os.environ.get("PORT", 7860))
88
+ )