LogicGoInfotechSpaces commited on
Commit
fc79b68
·
1 Parent(s): d5eecf2

Spaces: remove Dockerfile, guard Streamlit execution to avoid bare-mode

Browse files
Files changed (2) hide show
  1. Dockerfile +0 -9
  2. app.py +2 -3
Dockerfile DELETED
@@ -1,9 +0,0 @@
1
- FROM pytorch/pytorch:latest
2
-
3
- WORKDIR /app
4
-
5
- COPY . .
6
-
7
- RUN pip install -r requirements.txt
8
-
9
- CMD [ "streamlit", "run", "app.py" ]
 
 
 
 
 
 
 
 
 
 
app.py CHANGED
@@ -139,7 +139,6 @@ def run_streamlit_ui():
139
  "upload then remove the artifacts.")
140
 
141
 
142
- if __name__ == "__main__":
143
- # Streamlit Spaces run the file with `streamlit run app.py`
144
- # So keep a safe guard for direct execution as well
145
  run_streamlit_ui()
 
139
  "upload then remove the artifacts.")
140
 
141
 
142
+ # Only run when executed by Streamlit runner
143
+ if getattr(st, "runtime", None) and st.runtime.exists():
 
144
  run_streamlit_ui()