Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,15 +3,14 @@ import gradio as gr
|
|
| 3 |
import spaces
|
| 4 |
from transformers import pipeline
|
| 5 |
import torch
|
| 6 |
-
|
| 7 |
-
zero = torch.Tensor([0]).cuda()
|
| 8 |
-
print(zero.device) # <-- 'cpu' 🤔
|
| 9 |
|
| 10 |
token = os.getenv("HF_TOKEN")
|
|
|
|
| 11 |
# gr.load("models/ICILS/xlm-r-icils-ilo", hf_token=token).launch()
|
| 12 |
|
| 13 |
# Load the pre-trained model
|
| 14 |
-
classifier = pipeline("text-classification", model="ICILS/xlm-r-icils-ilo", use_auth_token=token)
|
| 15 |
|
| 16 |
# Define the prediction function
|
| 17 |
@spaces.GPU
|
|
|
|
| 3 |
import spaces
|
| 4 |
from transformers import pipeline
|
| 5 |
import torch
|
| 6 |
+
import huggingface_hub
|
|
|
|
|
|
|
| 7 |
|
| 8 |
token = os.getenv("HF_TOKEN")
|
| 9 |
+
huggingface_hub.login(token=token)
|
| 10 |
# gr.load("models/ICILS/xlm-r-icils-ilo", hf_token=token).launch()
|
| 11 |
|
| 12 |
# Load the pre-trained model
|
| 13 |
+
classifier = pipeline("text-classification", model="ICILS/xlm-r-icils-ilo", use_auth_token=token, device=torch.device)
|
| 14 |
|
| 15 |
# Define the prediction function
|
| 16 |
@spaces.GPU
|