mgokg commited on
Commit
1f1d56e
·
verified ·
1 Parent(s): a10a12d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -1
app.py CHANGED
@@ -69,4 +69,12 @@ stream = Stream(
69
  )
70
 
71
  if __name__ == "__main__":
72
- stream.ui.launch(server_port=7860)
 
 
 
 
 
 
 
 
 
69
  )
70
 
71
  if __name__ == "__main__":
72
+ import uvicorn
73
+ import os
74
+
75
+ # Hugging Face Spaces provides the port via an environment variable,
76
+ # but defaults to 7860.
77
+ port = int(os.getenv("PORT", 7860))
78
+
79
+ # We bind to 0.0.0.0 to make the app accessible within the HF container
80
+ uvicorn.run(app, host="0.0.0.0", port=port)