jjzha commited on
Commit
6df2cd4
·
verified ·
1 Parent(s): 3c343d3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,9 +1,11 @@
1
  import gradio as gr
 
2
  from transformers import pipeline
3
 
4
- token_skill_classifier = pipeline(model="jjzha/jobbert_skill_extraction", aggregation_strategy="first", device="cuda")
5
- token_knowledge_classifier = pipeline(model="jjzha/jobbert_knowledge_extraction", aggregation_strategy="first", device="cuda")
6
-
 
7
 
8
  examples = [
9
  "Knowing Python is a plus",
@@ -27,7 +29,7 @@ def aggregate_span(results):
27
 
28
  return new_results
29
 
30
-
31
  def ner(text):
32
  output_skills = token_skill_classifier(text)
33
  for result in output_skills:
 
1
  import gradio as gr
2
+ import spaces
3
  from transformers import pipeline
4
 
5
+ token_skill_classifier = pipeline(model="jjzha/jobbert_skill_extraction", aggregation_strategy="first")
6
+ token_knowledge_classifier = pipeline(model="jjzha/jobbert_knowledge_extraction", aggregation_strategy="first")
7
+ token_skill_classifier.to("cuda")
8
+ token_knowledge_classifier.to("cuda")
9
 
10
  examples = [
11
  "Knowing Python is a plus",
 
29
 
30
  return new_results
31
 
32
+ @spaces.GPU
33
  def ner(text):
34
  output_skills = token_skill_classifier(text)
35
  for result in output_skills: