cptsubtext commited on
Commit ·
cb04361
1
Parent(s): 53749fd
use a fix for the cache issue
Browse files
app.py
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import os
|
| 3 |
import json
|
|
@@ -7,9 +14,6 @@ import torch
|
|
| 7 |
import base64
|
| 8 |
from io import BytesIO
|
| 9 |
|
| 10 |
-
import os
|
| 11 |
-
import tempfile
|
| 12 |
-
|
| 13 |
# Configuration (similar to aim.py, but adapted for Streamlit)
|
| 14 |
DEFAULT_KEYWORD_COUNT = 5
|
| 15 |
DEFAULT_MODEL = "llava-hf/llava-1.5-7b-hf" # A common Llava model on Hugging Face
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
# Fix for permission errors in Hugging Face Spaces
|
| 3 |
+
os.environ["STREAMLIT_CONFIG_DIR"] = "/tmp/.streamlit"
|
| 4 |
+
os.environ["STREAMLIT_CACHE_DIR"] = "/tmp/.cache"
|
| 5 |
+
os.makedirs("/tmp/.streamlit", exist_ok=True)
|
| 6 |
+
os.makedirs("/tmp/.cache", exist_ok=True)
|
| 7 |
+
|
| 8 |
import streamlit as st
|
| 9 |
import os
|
| 10 |
import json
|
|
|
|
| 14 |
import base64
|
| 15 |
from io import BytesIO
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
# Configuration (similar to aim.py, but adapted for Streamlit)
|
| 18 |
DEFAULT_KEYWORD_COUNT = 5
|
| 19 |
DEFAULT_MODEL = "llava-hf/llava-1.5-7b-hf" # A common Llava model on Hugging Face
|