fffiloni commited on
Commit
5855ff8
1 Parent(s): 380a4c2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -16
app.py CHANGED
@@ -4,9 +4,7 @@ import cv2
4
  import numpy as np
5
 
6
  from moviepy.editor import *
7
- #from share_btn import community_icon_html, loading_icon_html, share_js
8
-
9
-
10
 
11
  xdecoder = gr.Interface.load(name="spaces/xdecoder/Instruct-X-Decoder")
12
 
@@ -80,8 +78,7 @@ def infer(prompt,video_in, trim_value):
80
  final_vid = create_video(result_frames, fps)
81
  print("finished !")
82
 
83
- #return final_vid, gr.Group.update(visible=True)
84
- return final_vid
85
 
86
  title = """
87
  <div style="text-align: center; max-width: 700px; margin: 0 auto;">
@@ -148,25 +145,21 @@ with gr.Blocks(css='style.css') as demo:
148
  trim_in = gr.Slider(label="Cut video at (s)", minimun=1, maximum=3, step=1, value=1)
149
  with gr.Column():
150
  video_out = gr.Video(label="Pix2pix video result", elem_id="video-output")
151
- gr.HTML("""
152
- <a style="display:inline-block" href="https://huggingface.co/spaces/fffiloni/Pix2Pix-Video?duplicate=true"><img src="https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14" alt="Duplicate Space"></a>
153
- work with longer videos / skip the queue:
154
- """, elem_id="duplicate-container")
155
  submit_btn = gr.Button("Generate X-Decoder video")
156
 
157
- #with gr.Group(elem_id="share-btn-container", visible=False) as share_group:
158
- # community_icon = gr.HTML(community_icon_html)
159
- # loading_icon = gr.HTML(loading_icon_html)
160
- # share_button = gr.Button("Share to community", elem_id="share-btn")
161
 
162
  inputs = [prompt, video_inp, trim_in]
163
- #outputs = [video_out, share_group]
164
- outputs = [video_out]
165
 
166
  gr.HTML(article)
167
 
168
  submit_btn.click(infer, inputs, outputs)
169
- #share_button.click(None, [], [], _js=share_js)
170
 
171
 
172
 
 
4
  import numpy as np
5
 
6
  from moviepy.editor import *
7
+ from share_btn import community_icon_html, loading_icon_html, share_js
 
 
8
 
9
  xdecoder = gr.Interface.load(name="spaces/xdecoder/Instruct-X-Decoder")
10
 
 
78
  final_vid = create_video(result_frames, fps)
79
  print("finished !")
80
 
81
+ return final_vid, gr.Group.update(visible=True)
 
82
 
83
  title = """
84
  <div style="text-align: center; max-width: 700px; margin: 0 auto;">
 
145
  trim_in = gr.Slider(label="Cut video at (s)", minimun=1, maximum=3, step=1, value=1)
146
  with gr.Column():
147
  video_out = gr.Video(label="Pix2pix video result", elem_id="video-output")
148
+
 
 
 
149
  submit_btn = gr.Button("Generate X-Decoder video")
150
 
151
+ with gr.Group(elem_id="share-btn-container", visible=False) as share_group:
152
+ community_icon = gr.HTML(community_icon_html)
153
+ loading_icon = gr.HTML(loading_icon_html)
154
+ share_button = gr.Button("Share to community", elem_id="share-btn")
155
 
156
  inputs = [prompt, video_inp, trim_in]
157
+ outputs = [video_out, share_group]
 
158
 
159
  gr.HTML(article)
160
 
161
  submit_btn.click(infer, inputs, outputs)
162
+ share_button.click(None, [], [], _js=share_js)
163
 
164
 
165