Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,13 +2,15 @@
|
|
2 |
|
3 |
import streamlit as st
|
4 |
import os
|
|
|
|
|
|
|
|
|
5 |
HF_TOKEN = os.getenv('HF_TOKEN')
|
6 |
from huggingface_hub import HfFolder
|
7 |
# Set the token using HfFolder (this persists the token)
|
8 |
HfFolder.save_token(HF_TOKEN)
|
9 |
|
10 |
-
import transformers
|
11 |
-
|
12 |
from transformers import pipeline
|
13 |
# Load the model, specifying the use of GPU if available
|
14 |
device = 0 if torch.cuda.is_available() else -1 # use GPU if available
|
|
|
2 |
|
3 |
import streamlit as st
|
4 |
import os
|
5 |
+
import torch # Add this line to import the torch library
|
6 |
+
import transformers
|
7 |
+
|
8 |
+
|
9 |
HF_TOKEN = os.getenv('HF_TOKEN')
|
10 |
from huggingface_hub import HfFolder
|
11 |
# Set the token using HfFolder (this persists the token)
|
12 |
HfFolder.save_token(HF_TOKEN)
|
13 |
|
|
|
|
|
14 |
from transformers import pipeline
|
15 |
# Load the model, specifying the use of GPU if available
|
16 |
device = 0 if torch.cuda.is_available() else -1 # use GPU if available
|