Spaces:
Sleeping
Sleeping
| #import os | |
| #os.system("python -m pip install --upgrade pip") | |
| #os.system("pip uninstall -y gradio") | |
| #os.system("pip install gradio==3.28.3") | |
| import gradio as gr | |
| from moviepy.editor import * | |
| import base64 | |
| def mp4_to_mp3(mp4): | |
| mp4_without_frames = AudioFileClip(mp4) | |
| mp4_without_frames.write_audiofile("audio.mp3") | |
| mp4_without_frames.close() | |
| with open('audio.mp3', 'rb') as file: | |
| mp3 = file.read() | |
| base64_mp3 = base64.b64encode(mp3).decode('utf-8') | |
| return base64_mp3 | |
| input_video = gr.Video(source="upload", type="filepath") | |
| output_text = gr.Textbox() | |
| interface = gr.Interface( | |
| fn=mp4_to_mp3, | |
| inputs=input_video, | |
| outputs=output_text, | |
| ) | |
| interface.launch() | |