Spaces:
Paused
Paused
Commit ·
b3bb554
1
Parent(s): 61be0c3
init!
Browse files
app.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import requests
|
| 3 |
+
from datetime import datetime, timedelta
|
| 4 |
+
from pytube import YouTube
|
| 5 |
+
from moviepy.editor import VideoFileClip
|
| 6 |
+
from tqdm import tqdm
|
| 7 |
+
import gradio as gr
|
| 8 |
+
|
| 9 |
+
# Create a function to download YouTube video
|
| 10 |
+
def download_youtube(url, nama_channel, new_name, extension):
|
| 11 |
+
# Your download_youtube function code here...
|
| 12 |
+
|
| 13 |
+
# Create a function to cut and save the video
|
| 14 |
+
def cut_video(start_time_str, end_time_str, filename, judul_video):
|
| 15 |
+
# Your cut_video function code here...
|
| 16 |
+
|
| 17 |
+
# Create a Gradio Interface
|
| 18 |
+
iface = gr.Interface(
|
| 19 |
+
fn=cut_video,
|
| 20 |
+
inputs=[
|
| 21 |
+
gr.inputs.Textbox(lines=1, label="Start Time (HH:MM:SS.MS)"),
|
| 22 |
+
gr.inputs.Textbox(lines=1, label="End Time (HH:MM:SS.MS)"),
|
| 23 |
+
gr.inputs.Textbox(lines=1, label="Original Video File Path"),
|
| 24 |
+
gr.inputs.Textbox(lines=1, label="Video Title"),
|
| 25 |
+
],
|
| 26 |
+
outputs=gr.outputs.File(label="Download Cut Video"),
|
| 27 |
+
title="YouTube Video Cutter",
|
| 28 |
+
description="Cut and download portions of YouTube videos.",
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
# Launch the Gradio interface
|
| 32 |
+
iface.launch()
|