danieldux commited on
Commit
043d807
·
verified ·
1 Parent(s): 352ade9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -14,13 +14,16 @@ classifier = pipeline("text-classification", model="ICILS/xlm-r-icils-ilo", devi
14
  # Define the prediction function
15
  @spaces.GPU
16
  def classify_text(text):
17
- return classifier(text)[0]
 
 
 
18
 
19
  # Create the Gradio interface
20
  demo = gr.Interface(
21
  fn=classify_text,
22
  inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
23
- outputs=gr.Text(),
24
  title="XLM-R ISCO classification with ZeroGPU",
25
  description="Classify occupations using a pre-trained XLM-R-ISCO model on Hugging Face Spaces with ZeroGPU"
26
  )
 
14
  # Define the prediction function
15
  @spaces.GPU
16
  def classify_text(text):
17
+ result = classifier(text)[0]
18
+ label = result['label']
19
+ score = result['score']
20
+ return label, score
21
 
22
  # Create the Gradio interface
23
  demo = gr.Interface(
24
  fn=classify_text,
25
  inputs=gr.Textbox(lines=2, placeholder="Enter text here..."),
26
+ outputs=[gr.Textbox(label="Label"), gr.Number(label="Score")],
27
  title="XLM-R ISCO classification with ZeroGPU",
28
  description="Classify occupations using a pre-trained XLM-R-ISCO model on Hugging Face Spaces with ZeroGPU"
29
  )