mbwanaf commited on
Commit
b79f679
·
verified ·
1 Parent(s): b57ccdf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -8
app.py CHANGED
@@ -1,16 +1,13 @@
1
  import os
2
 
3
- # Avoid Streamlit file watcher issues in Docker
4
  os.environ["STREAMLIT_WATCHED_MODULES"] = ""
 
 
5
 
6
- # Set a writable cache directory for Hugging Face models
7
- os.environ["TRANSFORMERS_CACHE"] = "./hf_cache"
8
- os.makedirs("./hf_cache", exist_ok=True)
9
 
10
- # Set Streamlit-specific options to prevent permission errors
11
- os.environ["STREAMLIT_HOME"] = os.getcwd()
12
- os.environ["STREAMLIT_RUNTIME_METRICS_ENABLED"] = "false"
13
- os.makedirs(".streamlit", exist_ok=True)
14
 
15
  import streamlit as st
16
  import torch
 
1
  import os
2
 
3
+ # Prevent Streamlit from watching files or writing to restricted dirs
4
  os.environ["STREAMLIT_WATCHED_MODULES"] = ""
5
+ os.environ["STREAMLIT_RUNTIME_METRICS_ENABLED"] = "false"
6
+ os.environ["STREAMLIT_HOME"] = os.getcwd()
7
 
8
+ # Set Hugging Face transformers cache to a safe, writable folder
9
+ os.environ["TRANSFORMERS_CACHE"] = "/tmp/hf_cache"
 
10
 
 
 
 
 
11
 
12
  import streamlit as st
13
  import torch