Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -43,8 +43,8 @@ def process_youtube_or_audio(url, recorded_audio):
|
|
43 |
ringtone_filename_m4r = f"downloads/{song_name}.m4r"
|
44 |
if not os.path.exists(ringtone_filename_m4r):
|
45 |
ringtone_audio = AudioSegment.from_file(mp3_filename)
|
46 |
-
|
47 |
-
ringtone_audio = ringtone_audio[:20000]
|
48 |
ringtone_audio.export(ringtone_filename_m4r, format="aac")
|
49 |
|
50 |
return mp3_filename, ringtone_filename_m4r
|
@@ -53,8 +53,12 @@ def process_youtube_or_audio(url, recorded_audio):
|
|
53 |
print(f"Error: {e}")
|
54 |
return None, None
|
55 |
|
56 |
-
# Gradio UI
|
57 |
-
with gr.Blocks(css="
|
|
|
|
|
|
|
|
|
58 |
gr.HTML("""
|
59 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
60 |
<h1><i class="fa fa-music"></i> PYTRR</h1>
|
@@ -71,7 +75,7 @@ with gr.Blocks(css="body { font-family: Arial, sans-serif; text-align: center; }
|
|
71 |
audio_record = gr.Audio(sources=["microphone"], type="filepath")
|
72 |
|
73 |
with gr.Row():
|
74 |
-
process_button = gr.Button("🎵 Create Ringtones", elem_id="process-btn")
|
75 |
|
76 |
with gr.Row():
|
77 |
with gr.Column(scale=1, min_width=250):
|
@@ -85,3 +89,4 @@ with gr.Blocks(css="body { font-family: Arial, sans-serif; text-align: center; }
|
|
85 |
process_button.click(process_youtube_or_audio, inputs=[youtube_url, audio_record], outputs=[mp3_download, iphone_ringtone])
|
86 |
|
87 |
interface.launch(share=True)
|
|
|
|
43 |
ringtone_filename_m4r = f"downloads/{song_name}.m4r"
|
44 |
if not os.path.exists(ringtone_filename_m4r):
|
45 |
ringtone_audio = AudioSegment.from_file(mp3_filename)
|
46 |
+
\
|
47 |
+
ringtone_audio = ringtone_audio[:20000] # 20 seconds
|
48 |
ringtone_audio.export(ringtone_filename_m4r, format="aac")
|
49 |
|
50 |
return mp3_filename, ringtone_filename_m4r
|
|
|
53 |
print(f"Error: {e}")
|
54 |
return None, None
|
55 |
|
56 |
+
# Gradio UI
|
57 |
+
with gr.Blocks(css="""
|
58 |
+
body { font-family: Arial, sans-serif; text-align: center; }
|
59 |
+
.light-btn { background-color: #f0f0f0; color: #333; border: 2px solid #ccc; }
|
60 |
+
.light-btn:hover { background-color: #e0e0e0; }
|
61 |
+
""") as interface:
|
62 |
gr.HTML("""
|
63 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
64 |
<h1><i class="fa fa-music"></i> PYTRR</h1>
|
|
|
75 |
audio_record = gr.Audio(sources=["microphone"], type="filepath")
|
76 |
|
77 |
with gr.Row():
|
78 |
+
process_button = gr.Button("🎵 Create Ringtones", elem_id="process-btn", elem_classes="light-btn")
|
79 |
|
80 |
with gr.Row():
|
81 |
with gr.Column(scale=1, min_width=250):
|
|
|
89 |
process_button.click(process_youtube_or_audio, inputs=[youtube_url, audio_record], outputs=[mp3_download, iphone_ringtone])
|
90 |
|
91 |
interface.launch(share=True)
|
92 |
+
|