Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -115,7 +115,7 @@ def merge_entities(entities):
|
|
115 |
if next_entity['entity'] == current['entity'] and (next_entity['start'] == current['end'] + 1 or next_entity['start'] == current['end']):
|
116 |
current['word'] += ' ' + next_entity['word']
|
117 |
current['end'] = next_entity['end']
|
118 |
-
else
|
119 |
merged.append(current)
|
120 |
current = next_entity
|
121 |
|
@@ -143,8 +143,6 @@ def ner(
|
|
143 |
)
|
144 |
],
|
145 |
}
|
146 |
-
|
147 |
-
print(r["entities"])
|
148 |
r["entities"] = merge_entities(r["entities"])
|
149 |
return r
|
150 |
|
@@ -152,13 +150,7 @@ def ner(
|
|
152 |
with gr.Blocks(title="GLiNER-medium-v2.1") as demo:
|
153 |
gr.Markdown(
|
154 |
"""
|
155 |
-
#
|
156 |
-
GLiNER is a Named Entity Recognition (NER) model capable of identifying any entity type using a bidirectional transformer encoder (BERT-like). It provides a practical alternative to traditional NER models, which are limited to predefined entities, and Large Language Models (LLMs) that, despite their flexibility, are costly and large for resource-constrained scenarios. This model has the commercially permissive Apache 2.0 license.
|
157 |
-
## Links
|
158 |
-
* Model: https://huggingface.co/urchade/gliner_medium-v2.1
|
159 |
-
* All GLiNER models: https://huggingface.co/models?library=gliner
|
160 |
-
* Paper: https://arxiv.org/abs/2311.08526
|
161 |
-
* Repository: https://github.com/urchade/GLiNER
|
162 |
"""
|
163 |
)
|
164 |
with gr.Accordion("How to run this model locally", open=False):
|
@@ -177,7 +169,7 @@ with gr.Blocks(title="GLiNER-medium-v2.1") as demo:
|
|
177 |
gr.Code(
|
178 |
'''
|
179 |
from gliner import GLiNER
|
180 |
-
model = GLiNER.from_pretrained("
|
181 |
text = """
|
182 |
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.
|
183 |
"""
|
|
|
115 |
if next_entity['entity'] == current['entity'] and (next_entity['start'] == current['end'] + 1 or next_entity['start'] == current['end']):
|
116 |
current['word'] += ' ' + next_entity['word']
|
117 |
current['end'] = next_entity['end']
|
118 |
+
else:
|
119 |
merged.append(current)
|
120 |
current = next_entity
|
121 |
|
|
|
143 |
)
|
144 |
],
|
145 |
}
|
|
|
|
|
146 |
r["entities"] = merge_entities(r["entities"])
|
147 |
return r
|
148 |
|
|
|
150 |
with gr.Blocks(title="GLiNER-medium-v2.1") as demo:
|
151 |
gr.Markdown(
|
152 |
"""
|
153 |
+
# NuZero
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
"""
|
155 |
)
|
156 |
with gr.Accordion("How to run this model locally", open=False):
|
|
|
169 |
gr.Code(
|
170 |
'''
|
171 |
from gliner import GLiNER
|
172 |
+
model = GLiNER.from_pretrained("numind/NuZero_token")
|
173 |
text = """
|
174 |
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.
|
175 |
"""
|