Spaces:
Build error
Build error
Commit ·
ca2c3c4
1
Parent(s): 7015a9e
cleaning the input
Browse files
app.py
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 3 |
|
|
@@ -6,7 +7,8 @@ model = AutoModelForSequenceClassification.from_pretrained("usman-yello/job-tagg
|
|
| 6 |
|
| 7 |
|
| 8 |
def tag_job_description(job_description):
|
| 9 |
-
|
|
|
|
| 10 |
outputs = model(**inputs)
|
| 11 |
predicted_tag = model.config.id2label[outputs.logits.argmax().item()]
|
| 12 |
return predicted_tag
|
|
|
|
| 1 |
+
import re
|
| 2 |
import gradio as gr
|
| 3 |
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 4 |
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
def tag_job_description(job_description):
|
| 10 |
+
job_description = re.sub(r'[^a-zA-Z]', ' ', job_description)
|
| 11 |
+
inputs = tokenizer(job_description, truncation=True, max_length=512, return_tensors="pt")
|
| 12 |
outputs = model(**inputs)
|
| 13 |
predicted_tag = model.config.id2label[outputs.logits.argmax().item()]
|
| 14 |
return predicted_tag
|