Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,13 @@
|
|
1 |
from transformers import pipeline
|
|
|
2 |
|
3 |
-
#
|
4 |
-
|
|
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
+
import os
|
3 |
|
4 |
+
# Set cache directory to a writable location
|
5 |
+
os.environ['TRANSFORMERS_CACHE'] = '/tmp/cache'
|
6 |
+
os.environ['HF_HOME'] = '/tmp/cache'
|
7 |
|
8 |
+
# Initialize model with smaller config
|
9 |
+
model = pipeline(
|
10 |
+
"text-generation",
|
11 |
+
model="gpt2",
|
12 |
+
device=-1 # Force CPU usage
|
13 |
+
)
|