Spaces:
Build error
Build error
Commit
·
3c111ba
1
Parent(s):
fbf39d0
Switched to cpu only...
Browse files
app.py
CHANGED
|
@@ -2,6 +2,8 @@ import streamlit as st
|
|
| 2 |
from transformers import pipeline
|
| 3 |
import torch
|
| 4 |
import os
|
|
|
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
# Retrieve the Hugging Face token from environment variables
|
|
@@ -16,7 +18,7 @@ if not hf_token:
|
|
| 16 |
def load_pipeline(model_name):
|
| 17 |
with st.spinner(f'Loading {model_name}... This may take several minutes.'):
|
| 18 |
try:
|
| 19 |
-
pipe = pipeline("text-generation", model=model_name)
|
| 20 |
except Exception as e:
|
| 21 |
st.error(f"An error occurred: {e}")
|
| 22 |
st.stop()
|
|
|
|
| 2 |
from transformers import pipeline
|
| 3 |
import torch
|
| 4 |
import os
|
| 5 |
+
import sys
|
| 6 |
+
|
| 7 |
|
| 8 |
|
| 9 |
# Retrieve the Hugging Face token from environment variables
|
|
|
|
| 18 |
def load_pipeline(model_name):
|
| 19 |
with st.spinner(f'Loading {model_name}... This may take several minutes.'):
|
| 20 |
try:
|
| 21 |
+
pipe = pipeline("text-generation", model=model_name,device=-1)
|
| 22 |
except Exception as e:
|
| 23 |
st.error(f"An error occurred: {e}")
|
| 24 |
st.stop()
|