prithivMLmods commited on
Commit
e692106
·
verified ·
1 Parent(s): 27c6f93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -15
app.py CHANGED
@@ -2,20 +2,22 @@ import gradio as gr
2
  import os
3
 
4
  def fetch(url, name, ext):
5
- opts = {
6
- "mp3": "-f \"ba\" -x --audio-format mp3",
7
- "mp4": "-f \"bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best\"",
8
- }[ext]
9
- filename = f"{name}.{ext}"
10
- os.system(f"yt-dlp {opts} {url} -o {filename}")
11
- return filename
12
-
13
  gr.Interface(
14
- fetch,
15
- [gr.Textbox(label="Media link", placeholder="URL goes here..."),
16
- gr.Textbox(label="File name", placeholder="best-vid"),
17
- gr.Dropdown(["mp3", "mp4"], value="mp4", label="File type")],
18
- gr.outputs.File(label="Download!"),
19
- description="Download web media! Works on most of the yt links",
20
- enable_queue=True
 
 
21
  ).launch()
 
2
  import os
3
 
4
  def fetch(url, name, ext):
5
+ opts = {
6
+ "mp3": "-f \"ba\" -x --audio-format mp3",
7
+ "mp4": "-f \"bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best\"",
8
+ }[ext]
9
+ filename = f"{name}.{ext}"
10
+ os.system(f"yt-dlp {opts} {url} -o {filename}")
11
+ return filename
12
+
13
  gr.Interface(
14
+ fetch,
15
+ [
16
+ gr.Textbox(label="Media link", placeholder="URL goes here..."),
17
+ gr.Textbox(label="File name", placeholder="best-vid"),
18
+ gr.Dropdown(["mp3", "mp4"], value="mp4", label="File type")
19
+ ],
20
+ gr.File(label="Download!"),
21
+ description="Download web media! Works on most of the yt links",
22
+ enable_queue=True
23
  ).launch()