GilbertClaus commited on
Commit
790c234
·
1 Parent(s): 7f14ba7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -29
app.py CHANGED
@@ -10,35 +10,19 @@ st.write("Potong dan download sebagian video YouTube.")
10
 
11
  video_link = st.text_input("Link Video")
12
  resolution = st.text_input("Resolusi", value='720')
13
- start_time = st.text_input("Start Time (HH:MM:SS.MS)", value='00:00:00.000')
14
- end_time = st.text_input("End Time (HH:MM:SS.MS)", value='00:01:00.000')
15
 
16
  if st.button("Download and Cut Video"):
17
  video_info, video_result, video_file = cut_video(video_link, resolution, start_time, end_time)
18
- st.write(video_info)
19
- st.video(video_result)
20
- st.download_button(label="Download Hasil Potongan Video", data=video_file, file_name="cut_video.mp4")
21
-
22
-
23
-
24
- # import gradio as gr
25
- # from youtube import cut_video
26
-
27
- # iface = gr.Interface(
28
- # fn=cut_video,
29
- # inputs=[
30
- # gr.inputs.Textbox(lines=1, label="Link Video"),
31
- # gr.inputs.Textbox(lines=1, label="Resolusi", default='720'),
32
- # gr.inputs.Textbox(lines=1, label="Start Time (HH:MM:SS.MS)", default='00:00:00.000'),
33
- # gr.inputs.Textbox(lines=1, label="End Time (HH:MM:SS.MS)", default='00:01:00.000'),
34
- # ],
35
- # outputs=[
36
- # gr.outputs.Textbox(label="Video Information"),
37
- # gr.outputs.Video(label="Hasil Video"),
38
- # gr.outputs.File(label="Download Hasil Potongan Video"),
39
- # ],
40
- # title="YouTube Video Cutter",
41
- # description="Potong dan download sebagian video YouTube.",
42
- # )
43
-
44
- # iface.launch()
 
10
 
11
  video_link = st.text_input("Link Video")
12
  resolution = st.text_input("Resolusi", value='720')
13
+ start_time = st.text_input("Start Time", value='00:00:00.000')
14
+ end_time = st.text_input("End Time", value='00:01:00.000')
15
 
16
  if st.button("Download and Cut Video"):
17
  video_info, video_result, video_file = cut_video(video_link, resolution, start_time, end_time)
18
+ num_lines = info.count('\n') + 1
19
+ text_area_height = 25 * num_lines
20
+ st.text_area("Hasil Tracing", video_info, height=text_area_height)
21
+ st.video(video_result)
22
+ with open(video_file, 'rb') as f:
23
+ file_contents = f.read()
24
+ st.download_button(
25
+ label="Download Hasil Potongan Video",
26
+ data=file_contents,
27
+ file_name=video_file.replace('/home/user/app/', '').title().replace('Mp4', 'mp4'),
28
+ mime='application/octet-stream'