Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -136,7 +136,24 @@ def dl(inp):
|
|
136 |
print (e)
|
137 |
out = None
|
138 |
return out,out,out,out,fps
|
139 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
140 |
def trim_vid(vid,start_time,end_time):
|
141 |
print (vid)
|
142 |
start_hr=float(start_time.split(":",2)[0])*360
|
@@ -247,6 +264,11 @@ with gr.Blocks() as app:
|
|
247 |
frame_num=gr.Textbox(label="Progress")
|
248 |
rem_vid=gr.Gallery(columns=6)
|
249 |
rem_bg_vid=gr.Video()
|
|
|
|
|
|
|
|
|
|
|
250 |
with gr.Row(visible=False):
|
251 |
text_input=gr.Textbox()
|
252 |
text_output=gr.Textbox()
|
@@ -255,6 +277,7 @@ with gr.Blocks() as app:
|
|
255 |
def echo_fn(inp):
|
256 |
return inp
|
257 |
#outp_vid.change(echo_fn,outp_vid,[out_trim])
|
|
|
258 |
speed_btn.click(update_speed,[hid_box,clip_speed,hid_fps],[outp_vid,hid_box])
|
259 |
gif_btn.click(make_gif,None,[gif_show,gif_file])
|
260 |
trim_btn.click(trim_vid,[hid_box,start_f,end_f],[out_trim,in_vid,trim_count])
|
|
|
136 |
print (e)
|
137 |
out = None
|
138 |
return out,out,out,out,fps
|
139 |
+
def dl_json(inp):
|
140 |
+
out_json={}
|
141 |
+
try:
|
142 |
+
inp_out=inp.replace("https://","")
|
143 |
+
inp_out=inp_out.replace("/","_").replace(".","_")
|
144 |
+
os.system(f'yt-dlp "{inp}" --write-info-json --skip-download -o "{inp_out}"')
|
145 |
+
out_file.append(f"{inp_out}.info.json")
|
146 |
+
out_json=f'{inp_out}.info.json'
|
147 |
+
try:
|
148 |
+
with open(f"{inp_out}.info.json", "r") as f:
|
149 |
+
f_out = f.read()
|
150 |
+
json_object = json.loads(f_out)
|
151 |
+
out_json = json.dumps(json_object, indent=4)
|
152 |
+
except Exception as e:
|
153 |
+
print (e)
|
154 |
+
except Exception as e:
|
155 |
+
print (e)
|
156 |
+
return out_json
|
157 |
def trim_vid(vid,start_time,end_time):
|
158 |
print (vid)
|
159 |
start_hr=float(start_time.split(":",2)[0])*360
|
|
|
264 |
frame_num=gr.Textbox(label="Progress")
|
265 |
rem_vid=gr.Gallery(columns=6)
|
266 |
rem_bg_vid=gr.Video()
|
267 |
+
with gr.Tab("Info"):
|
268 |
+
with gr.Row():
|
269 |
+
info_btn = gr.Button("Make GIF")
|
270 |
+
info_stat=gr.Textbox("Status")
|
271 |
+
info_json = gr.JSON()
|
272 |
with gr.Row(visible=False):
|
273 |
text_input=gr.Textbox()
|
274 |
text_output=gr.Textbox()
|
|
|
277 |
def echo_fn(inp):
|
278 |
return inp
|
279 |
#outp_vid.change(echo_fn,outp_vid,[out_trim])
|
280 |
+
info_btn.click(dl_json,inp_url,info_json)
|
281 |
speed_btn.click(update_speed,[hid_box,clip_speed,hid_fps],[outp_vid,hid_box])
|
282 |
gif_btn.click(make_gif,None,[gif_show,gif_file])
|
283 |
trim_btn.click(trim_vid,[hid_box,start_f,end_f],[out_trim,in_vid,trim_count])
|