AhmedBou commited on
Commit
134e79e
1 Parent(s): 439d765

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -7
app.py CHANGED
@@ -1,7 +1,13 @@
1
  import gradio as gr
2
 
3
- # Load the model
4
- model = gr.load("models/AhmedBou/JoBert")
 
 
 
 
 
 
5
 
6
  # Define the title and text labels
7
  title = "Classify Job Descriptions at the Span Level"
@@ -15,13 +21,10 @@ label_texts = {
15
  }
16
 
17
  # Create the Gradio interface
18
- def classify_job_description(text):
19
- return model(text)
20
-
21
  interface = gr.Interface(
22
  fn=classify_job_description,
23
- inputs=gr.inputs.Textbox(lines=10, placeholder="Enter job description here..."),
24
- outputs=gr.outputs.Textbox(label="Classification Results"),
25
  title=title,
26
  description="\n".join([f"{key}: {value}" for key, value in label_texts.items()])
27
  )
 
1
  import gradio as gr
2
 
3
+ def classify_job_description(text):
4
+ import transformers
5
+ from transformers import pipeline
6
+
7
+ nlp = pipeline("text-classification", model="your_model_name")
8
+ result = nlp(text)
9
+ # Process the result to extract labels and confidences
10
+ return result
11
 
12
  # Define the title and text labels
13
  title = "Classify Job Descriptions at the Span Level"
 
21
  }
22
 
23
  # Create the Gradio interface
 
 
 
24
  interface = gr.Interface(
25
  fn=classify_job_description,
26
+ inputs=gr.components.Textbox(lines=10, placeholder="Enter job description here..."),
27
+ outputs=gr.components.Tabular(headers=["Label", "Confidence"]),
28
  title=title,
29
  description="\n".join([f"{key}: {value}" for key, value in label_texts.items()])
30
  )