Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,101 +2,99 @@ from typing import Dict, Union
|
|
2 |
from gliner import GLiNER
|
3 |
import gradio as gr
|
4 |
|
5 |
-
model = GLiNER.from_pretrained("urchade/
|
6 |
|
7 |
examples = [
|
8 |
[
|
9 |
-
"
|
10 |
-
"person,
|
11 |
-
0.
|
12 |
-
|
13 |
],
|
14 |
[
|
15 |
-
""
|
16 |
-
|
17 |
-
|
18 |
-
* Machine Learning experience preferred
|
19 |
-
* Experience with programming languages such as Python, C++, or SQL preferred
|
20 |
-
* Experience with technologies such as Databricks, Qlik, TensorFlow, PyTorch, Python, Dash, Pandas, or NumPy preferred
|
21 |
-
* BA or BS degree
|
22 |
-
* Active Secret OR Active Top Secret or Active TS/SCI clearance
|
23 |
-
""",
|
24 |
-
"software package, programing language, software tool, degree, job title",
|
25 |
-
0.3,
|
26 |
False,
|
27 |
],
|
28 |
[
|
29 |
-
"
|
30 |
-
"
|
31 |
-
0.
|
32 |
False,
|
33 |
],
|
34 |
[
|
35 |
-
"
|
36 |
-
"
|
37 |
-
0.
|
38 |
False,
|
39 |
],
|
40 |
[
|
41 |
-
"
|
42 |
-
"
|
43 |
-
0.
|
44 |
False,
|
45 |
],
|
46 |
[
|
47 |
-
"
|
48 |
-
"person, company,
|
49 |
-
0.
|
50 |
-
|
51 |
],
|
52 |
[
|
53 |
-
"
|
54 |
-
"person,
|
55 |
-
0.
|
56 |
False,
|
57 |
],
|
58 |
[
|
59 |
-
"
|
60 |
-
"
|
61 |
-
0.
|
62 |
False,
|
63 |
],
|
64 |
[
|
65 |
-
"
|
66 |
-
"person,
|
67 |
-
0.
|
68 |
False,
|
69 |
],
|
70 |
[
|
71 |
-
"
|
72 |
-
"
|
73 |
-
0.
|
74 |
False,
|
75 |
],
|
76 |
[
|
77 |
-
"
|
78 |
-
"person,
|
79 |
-
0.
|
80 |
False,
|
81 |
],
|
82 |
[
|
83 |
-
"
|
84 |
-
"person,
|
85 |
-
0.
|
86 |
False,
|
87 |
],
|
88 |
[
|
89 |
-
"
|
90 |
-
"
|
91 |
-
0.
|
92 |
False,
|
93 |
],
|
94 |
[
|
95 |
-
"
|
96 |
-
"
|
97 |
-
0.
|
98 |
False,
|
99 |
],
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
]
|
101 |
|
102 |
|
@@ -153,14 +151,13 @@ with gr.Blocks(title="GLiNER-M-v2.1") as demo:
|
|
153 |
'''
|
154 |
from gliner import GLiNER
|
155 |
|
156 |
-
model = GLiNER.from_pretrained("urchade/
|
157 |
|
158 |
text = """
|
159 |
-
|
160 |
"""
|
161 |
|
162 |
-
labels = ["person", "
|
163 |
-
|
164 |
entities = model.predict_entities(text, labels)
|
165 |
|
166 |
for entity in entities:
|
@@ -170,18 +167,12 @@ for entity in entities:
|
|
170 |
)
|
171 |
gr.Code(
|
172 |
"""
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
European Golden Shoes => award
|
180 |
-
UEFA Champions Leagues => competitions
|
181 |
-
UEFA European Championship => competitions
|
182 |
-
UEFA Nations League => competitions
|
183 |
-
Champions League => competitions
|
184 |
-
European Championship => competitions
|
185 |
"""
|
186 |
)
|
187 |
|
|
|
2 |
from gliner import GLiNER
|
3 |
import gradio as gr
|
4 |
|
5 |
+
model = GLiNER.from_pretrained("urchade/gliner_multi_pii-v1")
|
6 |
|
7 |
examples = [
|
8 |
[
|
9 |
+
"Pierre Dubois, résident de Paris, a fondé sa propre entreprise, Le Petit Café, située au 15 Rue de la Paix. Son numéro d'entreprise est FR-987654321-1, et il utilise le compte bancaire 9876543210 pour les transactions.",
|
10 |
+
"person, organization, address, company registration number, bank account number",
|
11 |
+
0.5,
|
12 |
+
False,
|
13 |
],
|
14 |
[
|
15 |
+
"Leticia Ramírez, una habitante de Barcelona, tiene una cita médica programada en el Hospital General de Cataluña, situado en 10 Calle de los Ángeles. Su número de la seguridad social es ES-123456789-A y su grupo sanguíneo es AB+.",
|
16 |
+
"person, location, address, social security number, blood type",
|
17 |
+
0.5,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
False,
|
19 |
],
|
20 |
[
|
21 |
+
"John Smith, from London, teaches mathematics at Royal Academy located at 25 King’s Road. His employee ID is UK-987654-321 and he has been working there since 2015.",
|
22 |
+
"person, profession, organization, address, employee ID number",
|
23 |
+
0.5,
|
24 |
False,
|
25 |
],
|
26 |
[
|
27 |
+
"In Frankfurt, Claudia Weber frequently visits her local bank branch, Deutsche Bank, at 48 Hauptstraße. Her account number is DE-1234567890123456, used primarily for her mortgage payments.",
|
28 |
+
"person, location, address, bank account number",
|
29 |
+
0.5,
|
30 |
False,
|
31 |
],
|
32 |
[
|
33 |
+
"Marta Rossi, residente a Roma, ha acquistato un appartamento al 123 Via Condotti. Il numero di registrazione della proprietà è IT-654321-2018 e il mutuo è gestito tramite la Banca d'Italia con numero di conto 3216549870.",
|
34 |
+
"person, address, property registration number, bank account number",
|
35 |
+
0.5,
|
36 |
False,
|
37 |
],
|
38 |
[
|
39 |
+
"Paulo Coelho, um turista do Brasil, fez um seguro de viagem com a empresa Seguros PT antes de sua viagem para Lisboa. O número da apólice é BR-987654321-123 e inclui cobertura médica.",
|
40 |
+
"person, nationality, company, insurance policy number, coverage",
|
41 |
+
0.5,
|
42 |
+
False,
|
43 |
],
|
44 |
[
|
45 |
+
"Julia Fischer, eine Kundin aus München, hat bei der BayWa AG, einem großen Anbieter von Baustoffen mit Sitz am 77 Industriestraße, einen Kredit aufgenommen. Die Kreditnummer lautet DE-12345678.",
|
46 |
+
"person, city, organization, address, loan number",
|
47 |
+
0.5,
|
48 |
False,
|
49 |
],
|
50 |
[
|
51 |
+
"Carlos Sánchez, profesor en la Universidad de Madrid, reside en el 5 Calle de Alcalá. Su número de identificación de profesor es ES-192837465 y tiene un doctorado en filosofía.",
|
52 |
+
"person, profession, address, teacher ID number, degree",
|
53 |
+
0.5,
|
54 |
False,
|
55 |
],
|
56 |
[
|
57 |
+
"Sophie Dupont, une journaliste française, travaille pour Le Monde, basé au 33 rue des Écoles à Paris. Son numéro d'identification de presse est FR-75649023.",
|
58 |
+
"person, profession, organization, address, press ID number",
|
59 |
+
0.5,
|
60 |
False,
|
61 |
],
|
62 |
[
|
63 |
+
"Manuel Oliveira, um agricultor em Porto, possui uma grande plantação de vinhas na Rua da Estrada, 120. O número de registro agrícola é PT-5678912345.",
|
64 |
+
"person, profession, address, agricultural registration number",
|
65 |
+
0.5,
|
66 |
False,
|
67 |
],
|
68 |
[
|
69 |
+
"Elisa Müller, eine Künstlerin aus Berlin, hat ihre neueste Skulptur im öffentlichen Park am Alexanderplatz ausgestellt. Ihre Künstlernummer lautet DE-112233445.",
|
70 |
+
"person, profession, location, artist ID number",
|
71 |
+
0.5,
|
72 |
False,
|
73 |
],
|
74 |
[
|
75 |
+
"Federico García, un jugador de fútbol de Sevilla, ha firmado un contrato de tres años con el club Real Betis. Su número de licencia deportiva es ES-9876543210.",
|
76 |
+
"person, profession, organization, sports license number",
|
77 |
+
0.5,
|
78 |
False,
|
79 |
],
|
80 |
[
|
81 |
+
"Sarah White, a London-based actress, will be performing in 'Hamlet' at the Globe Theatre located at 21 New Globe Walk. Her Equity membership number is UK-1234567.",
|
82 |
+
"person, profession, location, address, membership number",
|
83 |
+
0.5,
|
84 |
False,
|
85 |
],
|
86 |
[
|
87 |
+
"Ricardo Mello, engenheiro civil, trabalha na construção da nova barragem no Rio Douro, Portugal. Seu número de registro profissional é PT-987654321.",
|
88 |
+
"person, profession, project location, professional registration number",
|
89 |
+
0.5,
|
90 |
False,
|
91 |
],
|
92 |
+
[
|
93 |
+
"Giuseppe Conti, un cliente di Milano, ha fatto un acquisto presso il negozio La Rinascente situato in Piazza Duomo. Il numero della sua carta di credito è IT-4567891234567891.",
|
94 |
+
"person, location, address, credit card number",
|
95 |
+
0.5,
|
96 |
+
False,
|
97 |
+
]
|
98 |
]
|
99 |
|
100 |
|
|
|
151 |
'''
|
152 |
from gliner import GLiNER
|
153 |
|
154 |
+
model = GLiNER.from_pretrained("urchade/gliner_multi_pii-v1")
|
155 |
|
156 |
text = """
|
157 |
+
Harilala Rasoanaivo, un homme d'affaires local d'Antananarivo, a enregistré une nouvelle société nommée "Rasoanaivo Enterprises" au Lot II M 92 Antohomadinika. Son numéro est le +261 32 22 345 67, et son adresse électronique est harilala.[email protected]. Il a fourni son numéro de sécu 501-02-1234 pour l'enregistrement.
|
158 |
"""
|
159 |
|
160 |
+
labels = ["work", "booking number", "personally identifiable information", "driver licence", "person", "book", "full address", "company", "actor", "character", "email", "passport number", "Social Security Number", "phone number"]
|
|
|
161 |
entities = model.predict_entities(text, labels)
|
162 |
|
163 |
for entity in entities:
|
|
|
167 |
)
|
168 |
gr.Code(
|
169 |
"""
|
170 |
+
Harilala Rasoanaivo => person
|
171 |
+
Rasoanaivo Enterprises => company
|
172 |
+
Lot II M 92 Antohomadinika => full address
|
173 |
+
+261 32 22 345 67 => phone number
|
174 |
+
[email protected] => email
|
175 |
+
501-02-1234 => Social Security Number
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
"""
|
177 |
)
|
178 |
|