Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,18 @@
|
|
1 |
import gradio as gr
|
|
|
|
|
2 |
|
3 |
def video_input(video):
|
4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
|
7 |
-
# We need to set resolutions.
|
8 |
-
# so, convert them from float to integer.
|
9 |
-
frame_width = int(video.get(3))
|
10 |
-
frame_height = int(video.get(4))
|
11 |
-
|
12 |
-
size = (frame_width, frame_height)
|
13 |
-
|
14 |
-
# Below VideoWriter object will create
|
15 |
-
# a frame of above defined The output
|
16 |
-
# is stored in 'filename.avi' file.
|
17 |
-
result = cv2.VideoWriter('videos/filename.avi',
|
18 |
-
cv2.VideoWriter_fourcc(*'MJPG'),10, size)
|
19 |
-
|
20 |
iface = gr.Interface(
|
21 |
video_input,
|
22 |
gr.inputs.Video(source="upload"),
|
|
|
1 |
import gradio as gr
|
2 |
+
from moviepy.editor import AudioFileClip
|
3 |
+
from pydub import AudioSegment
|
4 |
|
5 |
def video_input(video):
|
6 |
+
ext="wav"
|
7 |
+
print(video)
|
8 |
+
save_path='sounds/isim'
|
9 |
+
AudioFileClip(video).write_audiofile(f"{save_path}.{ext}",codec='pcm_s32le')
|
10 |
+
# cv=convertWav(video).beginn()
|
11 |
+
sound = AudioSegment.from_wav(save_path + '.' + ext)
|
12 |
+
sound = sound.set_channels(1)
|
13 |
+
sound.export(save_path + '.' + ext, format="wav")
|
14 |
|
15 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
iface = gr.Interface(
|
17 |
video_input,
|
18 |
gr.inputs.Video(source="upload"),
|