Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -141,22 +141,35 @@ interface_model_RE = gr.Interface(
|
|
141 |
|
142 |
#############################
|
143 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
pipe_N = pipeline(
|
145 |
"text2text-generation",
|
146 |
model="DReAMy-lib/t5-base-DreamBank-Generation-NER-Char",
|
147 |
max_length=300,
|
148 |
-
return_all_scores=True,
|
149 |
truncation="do_not_truncate",
|
150 |
)
|
151 |
def predictN(text):
|
152 |
t = pipe_N(text)
|
|
|
153 |
return t
|
154 |
interface_model_N = gr.Interface(
|
155 |
fn=predictN,
|
156 |
inputs='text',
|
157 |
outputs='text',
|
158 |
title="NER",
|
159 |
-
description=
|
160 |
examples=examples,
|
161 |
cache_examples=True,
|
162 |
)
|
|
|
141 |
|
142 |
#############################
|
143 |
|
144 |
+
pipe = pipeline(
|
145 |
+
"text2text-generation",
|
146 |
+
model=model_id,
|
147 |
+
max_length=300,
|
148 |
+
min_length=5,
|
149 |
+
)
|
150 |
+
|
151 |
+
# generate text graph
|
152 |
+
graph_text = pipe(text)
|
153 |
+
|
154 |
+
graph_text = graph_text[0]["generated_text"]
|
155 |
+
|
156 |
+
|
157 |
pipe_N = pipeline(
|
158 |
"text2text-generation",
|
159 |
model="DReAMy-lib/t5-base-DreamBank-Generation-NER-Char",
|
160 |
max_length=300,
|
|
|
161 |
truncation="do_not_truncate",
|
162 |
)
|
163 |
def predictN(text):
|
164 |
t = pipe_N(text)
|
165 |
+
t = t[0]["generated_text"]
|
166 |
return t
|
167 |
interface_model_N = gr.Interface(
|
168 |
fn=predictN,
|
169 |
inputs='text',
|
170 |
outputs='text',
|
171 |
title="NER",
|
172 |
+
description=description_GNER,
|
173 |
examples=examples,
|
174 |
cache_examples=True,
|
175 |
)
|