Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,9 +34,15 @@ def process_youtube_or_audio(url, recorded_audio):
|
|
| 34 |
if not filename or not os.path.exists(filename):
|
| 35 |
return None, None
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
mp3_filename = f"downloads/{song_name}.mp3"
|
| 38 |
if not os.path.exists(mp3_filename):
|
| 39 |
-
audio = AudioSegment.from_file(filename)
|
| 40 |
audio.export(mp3_filename, format="mp3")
|
| 41 |
|
| 42 |
m4a_filename = f"downloads/{song_name}.m4a"
|
|
@@ -55,8 +61,17 @@ def process_youtube_or_audio(url, recorded_audio):
|
|
| 55 |
|
| 56 |
with gr.Blocks(css="""
|
| 57 |
body { font-family: Arial, sans-serif; text-align: center; }
|
| 58 |
-
.light-btn {
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
""") as interface:
|
| 61 |
gr.HTML("""
|
| 62 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|
@@ -89,5 +104,3 @@ with gr.Blocks(css="""
|
|
| 89 |
|
| 90 |
interface.launch(share=True)
|
| 91 |
|
| 92 |
-
|
| 93 |
-
|
|
|
|
| 34 |
if not filename or not os.path.exists(filename):
|
| 35 |
return None, None
|
| 36 |
|
| 37 |
+
|
| 38 |
+
audio = AudioSegment.from_file(filename)
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
if len(audio) > 20000:
|
| 42 |
+
audio = audio[:20000]
|
| 43 |
+
|
| 44 |
mp3_filename = f"downloads/{song_name}.mp3"
|
| 45 |
if not os.path.exists(mp3_filename):
|
|
|
|
| 46 |
audio.export(mp3_filename, format="mp3")
|
| 47 |
|
| 48 |
m4a_filename = f"downloads/{song_name}.m4a"
|
|
|
|
| 61 |
|
| 62 |
with gr.Blocks(css="""
|
| 63 |
body { font-family: Arial, sans-serif; text-align: center; }
|
| 64 |
+
.light-btn {
|
| 65 |
+
background-color: #ADD8E6; /* Light Blue */
|
| 66 |
+
color: #333;
|
| 67 |
+
border: 2px solid #ccc;
|
| 68 |
+
padding: 10px 20px;
|
| 69 |
+
font-size: 16px;
|
| 70 |
+
cursor: pointer;
|
| 71 |
+
}
|
| 72 |
+
.light-btn:hover {
|
| 73 |
+
background-color: #87CEFA; /* Slightly darker blue on hover */
|
| 74 |
+
}
|
| 75 |
""") as interface:
|
| 76 |
gr.HTML("""
|
| 77 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|
|
|
| 104 |
|
| 105 |
interface.launch(share=True)
|
| 106 |
|
|
|
|
|
|