Linoy Tsaban commited on
Commit
d7d00c9
1 Parent(s): fd2f593

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -22
app.py CHANGED
@@ -1,22 +1,46 @@
1
- import gradio as gr
2
- import os
3
- from torchvision.io import read_video,write_video
4
- def video_identity(video):
5
- video, _, _ = read_video(video, output_format="TCHW")
6
- return str(type(video))
7
-
8
- with gr.Blocks() as demo:
9
- vid = gr.Video()
10
- vid_out = gr.Video()
11
- text = gr.Textbox()
12
- vid.upload(fn = video_identity, inputs = [vid], outputs=[text])
13
- # demo = gr.Interface(video_identity,
14
- # gr.Video(),
15
- # "playable_video",
16
- # # examples=[
17
- # # os.path.join(os.path.abspath(''),
18
- # # "video/video_sample.mp4")],
19
- # )
20
-
21
- if __name__ == "__main__":
22
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ########
2
+ # demo #
3
+ ########
4
+
5
+
6
+ intro = """
7
+ <h1 style="font-weight: 1400; text-align: center; margin-bottom: 7px;">
8
+ TokenFlow
9
+ </h1>
10
+ """
11
+
12
+
13
+
14
+ with gr.Blocks(css="style.css") as demo:
15
+
16
+ gr.HTML(intro)
17
+
18
+
19
+ with gr.Row():
20
+ input_vid = gr.Video(label="Input Video", interactive=True, elem_id="input_video")
21
+ output_vid = gr.Image(label="Edited Video", interactive=False, elem_id="output_video")
22
+ input_vid.style(height=365, width=365)
23
+ output_vid.style(height=365, width=365)
24
+
25
+ with gr.Group(visible=False) as share_btn_container:
26
+ with gr.Group(elem_id="share-btn-container"):
27
+ community_icon = gr.HTML(community_icon_html, visible=True)
28
+ loading_icon = gr.HTML(loading_icon_html, visible=False)
29
+ share_button = gr.Button("Share to community", elem_id="share-btn", visible=True)
30
+
31
+
32
+ with gr.Row():
33
+ inversion_progress = gr.Textbox(visible=False, label="Inversion progress")
34
+
35
+
36
+
37
+ with gr.Row():
38
+ run_button = gr.Button("Edit your video!", visible=True)
39
+
40
+
41
+ # with gr.Accordion("Advanced Options", open=False):
42
+
43
+
44
+
45
+ demo.queue()
46
+ demo.launch()