danieldux commited on
Commit
352ade9
·
verified ·
1 Parent(s): 6b9f417

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -2,15 +2,14 @@ import os
2
  import gradio as gr
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=True, device='cuda:0')
14
 
15
  # Define the prediction function
16
  @spaces.GPU
@@ -26,4 +25,5 @@ demo = gr.Interface(
26
  description="Classify occupations using a pre-trained XLM-R-ISCO model on Hugging Face Spaces with ZeroGPU"
27
  )
28
 
29
- demo.launch()
 
 
2
  import gradio as gr
3
  import spaces
4
  from transformers import pipeline
 
5
  import huggingface_hub
6
 
7
+ # Login to Hugging Face Hub
8
  token = os.getenv("HF_TOKEN")
9
  huggingface_hub.login(token=token)
 
10
 
11
  # Load the pre-trained model
12
+ classifier = pipeline("text-classification", model="ICILS/xlm-r-icils-ilo", device=0)
13
 
14
  # Define the prediction function
15
  @spaces.GPU
 
25
  description="Classify occupations using a pre-trained XLM-R-ISCO model on Hugging Face Spaces with ZeroGPU"
26
  )
27
 
28
+ if __name__ == "__main__":
29
+ demo.launch()