Spaces:
Sleeping
Sleeping
Tom Aarsen
commited on
Commit
•
4b92f32
1
Parent(s):
d4f95ae
Remove intentation in code snippets
Browse files
app.py
CHANGED
@@ -123,37 +123,37 @@ with gr.Blocks(title="GLiNER-base") as demo:
|
|
123 |
)
|
124 |
gr.Code(
|
125 |
'''
|
126 |
-
|
127 |
|
128 |
-
|
129 |
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
|
134 |
-
|
135 |
|
136 |
-
|
137 |
|
138 |
-
|
139 |
-
|
140 |
''',
|
141 |
language="python",
|
142 |
)
|
143 |
gr.Code(
|
144 |
"""
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
"""
|
158 |
)
|
159 |
|
|
|
123 |
)
|
124 |
gr.Code(
|
125 |
'''
|
126 |
+
from model import GLiNER
|
127 |
|
128 |
+
model = GLiNER.from_pretrained("urchade/gliner_base")
|
129 |
|
130 |
+
text = """
|
131 |
+
Cristiano Ronaldo dos Santos Aveiro (Portuguese pronunciation: [kɾiʃˈtjɐnu ʁɔˈnaldu]; born 5 February 1985) is a Portuguese professional footballer who plays as a forward for and captains both Saudi Pro League club Al Nassr and the Portugal national team. Widely regarded as one of the greatest players of all time, Ronaldo has won five Ballon d'Or awards,[note 3] a record three UEFA Men's Player of the Year Awards, and four European Golden Shoes, the most by a European player. He has won 33 trophies in his career, including seven league titles, five UEFA Champions Leagues, the UEFA European Championship and the UEFA Nations League. Ronaldo holds the records for most appearances (183), goals (140) and assists (42) in the Champions League, goals in the European Championship (14), international goals (128) and international appearances (205). He is one of the few players to have made over 1,200 professional career appearances, the most by an outfield player, and has scored over 850 official senior career goals for club and country, making him the top goalscorer of all time.
|
132 |
+
"""
|
133 |
|
134 |
+
labels = ["person", "award", "date", "competitions", "teams"]
|
135 |
|
136 |
+
entities = model.predict_entities(text, labels)
|
137 |
|
138 |
+
for entity in entities:
|
139 |
+
print(entity["text"], "=>", entity["label"])
|
140 |
''',
|
141 |
language="python",
|
142 |
)
|
143 |
gr.Code(
|
144 |
"""
|
145 |
+
Cristiano Ronaldo dos Santos Aveiro => person
|
146 |
+
5 February 1985 => date
|
147 |
+
Al Nassr => teams
|
148 |
+
Portugal national team => teams
|
149 |
+
Ballon d'Or => award
|
150 |
+
UEFA Men's Player of the Year Awards => award
|
151 |
+
European Golden Shoes => award
|
152 |
+
UEFA Champions Leagues => competitions
|
153 |
+
UEFA European Championship => competitions
|
154 |
+
UEFA Nations League => competitions
|
155 |
+
Champions League => competitions
|
156 |
+
European Championship => competitions
|
157 |
"""
|
158 |
)
|
159 |
|