Spaces:
Runtime error
Runtime error
storresbusquets
commited on
Commit
·
daa5ff3
1
Parent(s):
ffee274
Update app.py
Browse files
app.py
CHANGED
@@ -73,7 +73,7 @@ class GradioInference:
|
|
73 |
|
74 |
# Perform summarization on the transcription
|
75 |
transcription_summary = self.summarizer(
|
76 |
-
results["text"], max_length=
|
77 |
)
|
78 |
|
79 |
#### Prueba
|
@@ -123,13 +123,31 @@ class GradioInference:
|
|
123 |
# WordCloud image to display
|
124 |
wordcloud_image = wordcloud.to_image()
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
def populate_metadata(self, link):
|
135 |
"""
|
@@ -161,7 +179,7 @@ class GradioInference:
|
|
161 |
|
162 |
# Perform summarization on the transcription
|
163 |
transcription_summary = self.summarizer(
|
164 |
-
results["text"], max_length=
|
165 |
)
|
166 |
|
167 |
#### Prueba
|
@@ -210,13 +228,30 @@ class GradioInference:
|
|
210 |
)
|
211 |
wordcloud_image = wordcloud.to_image()
|
212 |
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
|
222 |
gio = GradioInference()
|
@@ -277,8 +312,7 @@ with block as demo:
|
|
277 |
inputs=[link, lang, size],
|
278 |
outputs=[text, summary, keywords, label, wordcloud_image],
|
279 |
)
|
280 |
-
|
281 |
-
link.change(gio.populate_metadata, inputs=[link], outputs=[img, title])
|
282 |
|
283 |
with gr.Tab("From Audio file"):
|
284 |
with gr.Box():
|
|
|
73 |
|
74 |
# Perform summarization on the transcription
|
75 |
transcription_summary = self.summarizer(
|
76 |
+
results["text"], max_length=150, min_length=30, do_sample=False
|
77 |
)
|
78 |
|
79 |
#### Prueba
|
|
|
123 |
# WordCloud image to display
|
124 |
wordcloud_image = wordcloud.to_image()
|
125 |
|
126 |
+
if lang.lower() == "english":
|
127 |
+
return (
|
128 |
+
results["text"],
|
129 |
+
transcription_summary[0]["summary_text"],
|
130 |
+
keywords,
|
131 |
+
label,
|
132 |
+
wordcloud_image,
|
133 |
+
)
|
134 |
+
else:
|
135 |
+
return (
|
136 |
+
results["text"],
|
137 |
+
summary,
|
138 |
+
keywords,
|
139 |
+
label,
|
140 |
+
wordcloud_image,
|
141 |
+
)
|
142 |
+
|
143 |
+
|
144 |
+
# return (
|
145 |
+
# results["text"],
|
146 |
+
# summary,
|
147 |
+
# keywords,
|
148 |
+
# label,
|
149 |
+
# wordcloud_image,
|
150 |
+
# )
|
151 |
|
152 |
def populate_metadata(self, link):
|
153 |
"""
|
|
|
179 |
|
180 |
# Perform summarization on the transcription
|
181 |
transcription_summary = self.summarizer(
|
182 |
+
results["text"], max_length=150, min_length=30, do_sample=False
|
183 |
)
|
184 |
|
185 |
#### Prueba
|
|
|
228 |
)
|
229 |
wordcloud_image = wordcloud.to_image()
|
230 |
|
231 |
+
if lang.lower() == "english":
|
232 |
+
return (
|
233 |
+
results["text"],
|
234 |
+
transcription_summary[0]["summary_text"],
|
235 |
+
keywords,
|
236 |
+
label,
|
237 |
+
wordcloud_image,
|
238 |
+
)
|
239 |
+
else:
|
240 |
+
return (
|
241 |
+
results["text"],
|
242 |
+
summary,
|
243 |
+
keywords,
|
244 |
+
label,
|
245 |
+
wordcloud_image,
|
246 |
+
)
|
247 |
+
|
248 |
+
# return (
|
249 |
+
# results["text"],
|
250 |
+
# summary,
|
251 |
+
# keywords,
|
252 |
+
# label,
|
253 |
+
# wordcloud_image,
|
254 |
+
# )
|
255 |
|
256 |
|
257 |
gio = GradioInference()
|
|
|
312 |
inputs=[link, lang, size],
|
313 |
outputs=[text, summary, keywords, label, wordcloud_image],
|
314 |
)
|
315 |
+
# link.change(gio.populate_metadata, inputs=[link], outputs=[img, title])
|
|
|
316 |
|
317 |
with gr.Tab("From Audio file"):
|
318 |
with gr.Box():
|