JoBert / app.py
AhmedBou's picture
Update app.py
134e79e verified
raw
history blame
985 Bytes
import gradio as gr
def classify_job_description(text):
import transformers
from transformers import pipeline
nlp = pipeline("text-classification", model="your_model_name")
result = nlp(text)
# Process the result to extract labels and confidences
return result
# Define the title and text labels
title = "Classify Job Descriptions at the Span Level"
label_texts = {
"Label_0": "About the Company:",
"Label_1": "Job Description:",
"Label_2": "Job Requirements:",
"Label_3": "Responsibilities:",
"Label_4": "Benefits:",
"Label_5": "Other:"
}
# Create the Gradio interface
interface = gr.Interface(
fn=classify_job_description,
inputs=gr.components.Textbox(lines=10, placeholder="Enter job description here..."),
outputs=gr.components.Tabular(headers=["Label", "Confidence"]),
title=title,
description="\n".join([f"{key}: {value}" for key, value in label_texts.items()])
)
# Launch the interface
interface.launch()