Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -62,40 +62,43 @@ def process_youtube_or_audio(url, uploaded_audio, start_time, end_time):
|
|
62 |
print(f"Error: {e}")
|
63 |
return None, None
|
64 |
|
65 |
-
# Gradio
|
66 |
with gr.Blocks() as interface:
|
67 |
gr.HTML("""
|
68 |
-
<h1><i class="fas fa-music"></i> PYTR - Python YouTube Ringtones</h1>
|
69 |
-
<p>Enter a YouTube URL or upload an audio file to create ringtones.</p>
|
70 |
-
<p><a href="https://ringtones.jessejesse.xyz">Ringtones</a></p>
|
71 |
-
<p><a href="https://github.com/sudo-self/pytr">GitHub</a></p>
|
72 |
""")
|
73 |
|
74 |
with gr.Row():
|
75 |
-
youtube_url = gr.Textbox(placeholder="Enter the URL here...", label="YouTube URL")
|
76 |
-
uploaded_audio = gr.File(label="Upload Audio File", type="filepath")
|
77 |
|
78 |
-
|
79 |
-
instructions = gr.Textbox(
|
80 |
-
value="Android: move the download to the 'Ringtones' folder.\nApple: import download with 'Garage Band' and export to ringtones.",
|
81 |
-
label="Install Ringtones",
|
82 |
-
interactive=False
|
83 |
-
)
|
84 |
|
85 |
-
gr.HTML("<h3>Trim Audio</h3>")
|
86 |
with gr.Row():
|
87 |
-
start_time = gr.Slider(0, 20, value=0, label="Start Time (seconds)")
|
88 |
-
end_time = gr.Slider(1, 20, value=20, label="End Time (seconds)")
|
89 |
|
90 |
-
|
|
|
91 |
|
92 |
with gr.Row():
|
93 |
-
mp3_download = gr.File(label="Android Ringtone")
|
94 |
-
iphone_ringtone = gr.File(label="iPhone Ringtone")
|
95 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
process_button.click(process_youtube_or_audio, inputs=[youtube_url, uploaded_audio, start_time, end_time], outputs=[mp3_download, iphone_ringtone])
|
97 |
|
98 |
interface.launch(share=True)
|
99 |
|
100 |
|
101 |
|
|
|
|
62 |
print(f"Error: {e}")
|
63 |
return None, None
|
64 |
|
65 |
+
# Gradio
|
66 |
with gr.Blocks() as interface:
|
67 |
gr.HTML("""
|
68 |
+
<h1 style="font-size: 2rem; text-align: center;"><i class="fas fa-music"></i> PYTR - Python YouTube Ringtones</h1>
|
69 |
+
<p style="text-align: center;">Enter a YouTube URL or upload an audio file to create ringtones.</p>
|
70 |
+
<p style="text-align: center;"><a href="https://ringtones.jessejesse.xyz">Ringtones</a> | <a href="https://github.com/sudo-self/pytr">GitHub</a></p>
|
|
|
71 |
""")
|
72 |
|
73 |
with gr.Row():
|
74 |
+
youtube_url = gr.Textbox(placeholder="Enter the URL here...", label="YouTube URL", style={"width": "45%"})
|
75 |
+
uploaded_audio = gr.File(label="Upload Audio File", type="filepath", style={"width": "45%"})
|
76 |
|
77 |
+
gr.HTML("<h3 style='text-align: center;'>Trim Audio</h3>")
|
|
|
|
|
|
|
|
|
|
|
78 |
|
|
|
79 |
with gr.Row():
|
80 |
+
start_time = gr.Slider(0, 20, value=0, label="Start Time (seconds)", style={"width": "45%"})
|
81 |
+
end_time = gr.Slider(1, 20, value=20, label="End Time (seconds)", style={"width": "45%"})
|
82 |
|
83 |
+
|
84 |
+
process_button = gr.Button("Create Ringtones", style={"width": "100%", "margin-top": "10px", "background-color": "#6a4cfc", "color": "white", "border": "none", "border-radius": "5px"})
|
85 |
|
86 |
with gr.Row():
|
87 |
+
mp3_download = gr.File(label="Android Ringtone", style={"width": "45%"})
|
88 |
+
iphone_ringtone = gr.File(label="iPhone Ringtone", style={"width": "45%"})
|
89 |
|
90 |
+
with gr.Row():
|
91 |
+
instructions = gr.Textbox(
|
92 |
+
value="Android: move the download to the 'Ringtones' folder.\nApple: import download with 'Garage Band' and export to ringtones.",
|
93 |
+
label="Install Ringtones",
|
94 |
+
interactive=False,
|
95 |
+
style={"width": "100%", "margin-top": "20px"}
|
96 |
+
)
|
97 |
+
|
98 |
process_button.click(process_youtube_or_audio, inputs=[youtube_url, uploaded_audio, start_time, end_time], outputs=[mp3_download, iphone_ringtone])
|
99 |
|
100 |
interface.launch(share=True)
|
101 |
|
102 |
|
103 |
|
104 |
+
|