Spaces:
Runtime error
Runtime error
File size: 1,863 Bytes
8619633 b315d3a 8619633 20b1214 8619633 20b1214 8619633 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
import gradio as gr
from utils.predict import predict_action
import os
import glob
##Create list of examples to be loaded
example_list = glob.glob("examples/*")
example_list = list(map(lambda el:[el], example_list))
demo = gr.Blocks()
with demo:
gr.Markdown("# **<p align='center'>Video Classification with Transformers</p>**")
description="""# <p>
<center>
Demo de clasificador de video usando modelo híbrido basado en Transformers con CNN, el objetivo es reconocer un segemento y recortarlo.
<img src=\"https://raw.githubusercontent.com/All-Aideas/sea_apirest/main/logo.png\" alt=\"logo\" width=\"250\"/>
</center>
</p>
"""
gr.Markdown(description)
with gr.Tabs():
with gr.TabItem("Upload & Predict"):
with gr.Box():
with gr.Row():
input_video = gr.Video(label="Input Video", show_label=True)
output_label = gr.Label(label="Model Output", show_label=True)
output_gif = gr.Image(label="Video Gif", show_label=True)
gr.Markdown("**Predict**")
with gr.Box():
with gr.Row():
submit_button = gr.Button("Submit")
gr.Markdown("**Ejemplos:**")
gr.Markdown("El modelo puede clasificar videos pertenecientes a las siguientes clases: CricketShot, PlayingCello, Punch, ShavingBeard, TennisSwing.")
# gr.Markdown("CricketShot, PlayingCello, Punch, ShavingBeard, TennisSwing")
with gr.Column():
gr.Examples(example_list, [input_video], [output_label,output_gif], predict_action, cache_examples=True)
submit_button.click(predict_action, inputs=input_video, outputs=[output_label,output_gif])
demo.launch()
|