Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,6 @@ import moviepy.editor as mp
|
|
2 |
import librosa
|
3 |
import numpy as np
|
4 |
import gradio as gr
|
5 |
-
from pytube import YouTube
|
6 |
import subprocess
|
7 |
|
8 |
|
@@ -23,11 +22,8 @@ def buffer_n_merge(intervals, buffer=0.1):
|
|
23 |
return new_intervals
|
24 |
|
25 |
|
26 |
-
def download_and_process_video(
|
27 |
-
|
28 |
-
youtube = YouTube(youtube_url)
|
29 |
-
vidpath = 'downloaded_video'
|
30 |
-
youtube.streams.first().download(filename=vidpath)
|
31 |
|
32 |
# load the video
|
33 |
video = mp.VideoFileClip(vidpath)
|
@@ -56,12 +52,12 @@ def download_and_process_video(youtube_url, threshold_db, buffer_sec):
|
|
56 |
iface = gr.Interface(
|
57 |
fn=download_and_process_video,
|
58 |
inputs=[
|
59 |
-
gr.inputs.
|
60 |
gr.inputs.Slider(minimum=1, maximum=70, step=1, default=30, label="Threshold (db)"),
|
61 |
gr.inputs.Slider(minimum=0, maximum=2, step=0.01, default=0.1, label="Buffer (sec)"),
|
62 |
],
|
63 |
outputs=gr.outputs.Video(label="Processed Video"),
|
64 |
-
title="
|
65 |
)
|
66 |
|
67 |
iface.launch()
|
|
|
2 |
import librosa
|
3 |
import numpy as np
|
4 |
import gradio as gr
|
|
|
5 |
import subprocess
|
6 |
|
7 |
|
|
|
22 |
return new_intervals
|
23 |
|
24 |
|
25 |
+
def download_and_process_video(threshold_db, buffer_sec):
|
26 |
+
vidpath = 'uploaded_video.mp4'
|
|
|
|
|
|
|
27 |
|
28 |
# load the video
|
29 |
video = mp.VideoFileClip(vidpath)
|
|
|
52 |
iface = gr.Interface(
|
53 |
fn=download_and_process_video,
|
54 |
inputs=[
|
55 |
+
gr.inputs.File(label="Video File", type="mp4"),
|
56 |
gr.inputs.Slider(minimum=1, maximum=70, step=1, default=30, label="Threshold (db)"),
|
57 |
gr.inputs.Slider(minimum=0, maximum=2, step=0.01, default=0.1, label="Buffer (sec)"),
|
58 |
],
|
59 |
outputs=gr.outputs.Video(label="Processed Video"),
|
60 |
+
title="Video Silence Remover"
|
61 |
)
|
62 |
|
63 |
iface.launch()
|