Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -48,19 +48,6 @@ with gr.Blocks(title="Textile Machinery NER Demo") as demo:
|
|
48 |
"""
|
49 |
)
|
50 |
|
51 |
-
with gr.Accordion("How to run this model locally", open=False):
|
52 |
-
gr.Markdown(
|
53 |
-
"""
|
54 |
-
## Installation
|
55 |
-
To use this model, you must install the GLiNER Python library:
|
56 |
-
```
|
57 |
-
!pip install gliner
|
58 |
-
```
|
59 |
-
|
60 |
-
## Usage
|
61 |
-
Once you've downloaded the GLiNER library, you can import the GLiNER class. You can then load this model using `GLiNER.from_pretrained` and predict entities with `predict_entities`.
|
62 |
-
"""
|
63 |
-
)
|
64 |
gr.Code(
|
65 |
'''
|
66 |
from gliner import GLiNER
|
@@ -82,7 +69,7 @@ Textile Machine 2 => textile machinery
|
|
82 |
|
83 |
# Display a random example
|
84 |
input_text = gr.Textbox(
|
85 |
-
value="
|
86 |
label="Text input",
|
87 |
placeholder="Enter your text here",
|
88 |
lines=5
|
@@ -135,38 +122,6 @@ Textile Machine 2 => textile machinery
|
|
135 |
inputs=[input_text, labels, threshold, nested_ner],
|
136 |
outputs=[output_highlighted, output_entities]
|
137 |
)
|
138 |
-
|
139 |
-
# Define examples
|
140 |
-
examples = [
|
141 |
-
[
|
142 |
-
"However, both models lack other frequent DM symptoms including the fibre-type dependent atrophy, myotonia, cataract and male-infertility.",
|
143 |
-
"textile machinery",
|
144 |
-
0.3,
|
145 |
-
False,
|
146 |
-
],
|
147 |
-
[
|
148 |
-
"Amelia Earhart flew her single engine Lockheed Vega 5B across the Atlantic to Paris.",
|
149 |
-
"textile machinery",
|
150 |
-
0.3,
|
151 |
-
False,
|
152 |
-
],
|
153 |
-
[
|
154 |
-
"The Shore Line route of the CNS & M until 1955 served, from south to north, the Illinois communities of Chicago, Evanston, Wilmette...",
|
155 |
-
"textile machinery",
|
156 |
-
0.3,
|
157 |
-
False,
|
158 |
-
],
|
159 |
-
# Add more examples as needed
|
160 |
-
]
|
161 |
-
|
162 |
-
gr.Examples(
|
163 |
-
examples=examples,
|
164 |
-
inputs=[input_text, labels, threshold, nested_ner],
|
165 |
-
outputs=[output_highlighted, output_entities],
|
166 |
-
fn=ner,
|
167 |
-
label="Examples",
|
168 |
-
cache_examples=True,
|
169 |
-
)
|
170 |
|
171 |
demo.queue()
|
172 |
demo.launch(debug=True)
|
|
|
48 |
"""
|
49 |
)
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
gr.Code(
|
52 |
'''
|
53 |
from gliner import GLiNER
|
|
|
69 |
|
70 |
# Display a random example
|
71 |
input_text = gr.Textbox(
|
72 |
+
value=" ",
|
73 |
label="Text input",
|
74 |
placeholder="Enter your text here",
|
75 |
lines=5
|
|
|
122 |
inputs=[input_text, labels, threshold, nested_ner],
|
123 |
outputs=[output_highlighted, output_entities]
|
124 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
demo.queue()
|
127 |
demo.launch(debug=True)
|