risingsaya12345
commited on
Commit
•
1c6cfc6
1
Parent(s):
84113ca
Initial commit or update
Browse files
app.py
ADDED
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load a multilingual zero-shot classification model that supports French
|
5 |
+
classifier = pipeline("zero-shot-classification", model="joeddav/xlm-roberta-large-xnli")
|
6 |
+
|
7 |
+
# Skill classification function in French
|
8 |
+
def classify_skills(text_input, candidate_labels):
|
9 |
+
labels = [label.strip() for label in candidate_labels.split(',')]
|
10 |
+
prediction = classifier(text_input, candidate_labels=labels)
|
11 |
+
|
12 |
+
# Formatting output as a dictionary of skills and confidence scores
|
13 |
+
output = {prediction['labels'][i]: prediction['scores'][i] for i in range(len(prediction['labels']))}
|
14 |
+
return output
|
15 |
+
|
16 |
+
# Examples related to skill classification in French
|
17 |
+
examples = [["Je maîtrise l'utilisation d'Excel et d'autres outils bureautiques", "compétence bureautique, programmation, gestion de projet"]]
|
18 |
+
|
19 |
+
# Custom CSS to give a distinct look and feel
|
20 |
+
css = """
|
21 |
+
footer {display:none !important}
|
22 |
+
.output-markdown{display:none !important}
|
23 |
+
.gr-button-primary {
|
24 |
+
z-index: 14;
|
25 |
+
height: 43px;
|
26 |
+
width: 130px;
|
27 |
+
left: 0px;
|
28 |
+
top: 0px;
|
29 |
+
padding: 0px;
|
30 |
+
cursor: pointer !important;
|
31 |
+
background: #112c45 !important;
|
32 |
+
border: none !important;
|
33 |
+
text-align: center !important;
|
34 |
+
font-family: Poppins !important;
|
35 |
+
font-size: 14px !important;
|
36 |
+
font-weight: 500 !important;
|
37 |
+
color: #ffffff !important;
|
38 |
+
line-height: 1 !important;
|
39 |
+
border-radius: 12px !important;
|
40 |
+
transition: box-shadow 200ms ease 0s, background 200ms ease 0s !important;
|
41 |
+
box-shadow: none !important;
|
42 |
+
}
|
43 |
+
.gr-button-primary:hover{
|
44 |
+
background: #4285F4 !important;
|
45 |
+
box-shadow: 0px 1px 7px 0px rgba(0, 0, 0, 0.23) !important;
|
46 |
+
}
|
47 |
+
"""
|
48 |
+
|
49 |
+
# Gradio interface for skill classification in French
|
50 |
+
demo = gr.Interface(
|
51 |
+
fn=classify_skills,
|
52 |
+
inputs=[gr.Textbox(label="Texte à classifier"), gr.Textbox(label="Compétences potentielles (séparées par des virgules)")],
|
53 |
+
outputs=gr.Label(label="Résultat de Classification des Compétences"),
|
54 |
+
title="Classification des Compétences | Modèle Multilingue",
|
55 |
+
examples=examples,
|
56 |
+
css=css
|
57 |
+
)
|
58 |
+
|
59 |
+
# Launch the interface
|
60 |
+
demo.launch()
|
skillmate
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
Subproject commit a8cb9ff18dd37707d0e06a61f55bb714bef13429
|