Spaces:
Runtime error
Runtime error
Commit
·
9defb2e
1
Parent(s):
97a7e85
Update app.py
Browse files
app.py
CHANGED
@@ -200,20 +200,12 @@ def inference(video, lang, full_scan, number_filter, use_trocr, time_step, perio
|
|
200 |
buf = io.BytesIO()
|
201 |
plot_fig.savefig(buf, format='png')
|
202 |
buf.seek(0)
|
203 |
-
plot_image = PIL.Image.open(buf)
|
204 |
-
|
205 |
-
# Resize the image to fit the width of the returned image
|
206 |
-
im_width, im_height = im.size
|
207 |
-
plot_width, plot_height = plot_image.size
|
208 |
-
new_plot_height = int(plot_height * im_width / plot_width)
|
209 |
-
resized_plot_image = plot_image.resize((im_width, new_plot_height), PIL.Image.ANTIALIAS)
|
210 |
-
|
211 |
# Convert the resized image to a NumPy array
|
212 |
-
plot_np = np.array(
|
213 |
|
214 |
# Close the buffer
|
215 |
buf.close()
|
216 |
-
|
217 |
return output, im, plot_np, df # Change this line
|
218 |
|
219 |
|
@@ -252,9 +244,9 @@ gr.Interface(
|
|
252 |
],
|
253 |
[
|
254 |
gr.outputs.Video(label='Output Video'),
|
255 |
-
gr.outputs.Image(label='Output Preview', type='numpy'),
|
256 |
# gr.Plot(label='Temporal Profile'),
|
257 |
-
gr.outputs.Image(label='Temporal Profile', type='numpy'),
|
258 |
gr.outputs.Dataframe(headers=['Box', 'Time (s)', 'Text'], type='pandas')
|
259 |
],
|
260 |
title=title,
|
|
|
200 |
buf = io.BytesIO()
|
201 |
plot_fig.savefig(buf, format='png')
|
202 |
buf.seek(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
203 |
# Convert the resized image to a NumPy array
|
204 |
+
plot_np = np.array(PIL.Image.open(buf))
|
205 |
|
206 |
# Close the buffer
|
207 |
buf.close()
|
208 |
+
|
209 |
return output, im, plot_np, df # Change this line
|
210 |
|
211 |
|
|
|
244 |
],
|
245 |
[
|
246 |
gr.outputs.Video(label='Output Video'),
|
247 |
+
gr.outputs.Image(label='Output Preview', type='numpy').style(height=480),
|
248 |
# gr.Plot(label='Temporal Profile'),
|
249 |
+
gr.outputs.Image(label='Temporal Profile', type='numpy').style(height=640),
|
250 |
gr.outputs.Dataframe(headers=['Box', 'Time (s)', 'Text'], type='pandas')
|
251 |
],
|
252 |
title=title,
|