sudo-soldier commited on
Commit
c79f358
·
verified ·
1 Parent(s): 0c13716

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -5
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 { background-color: #f0f0f0; color: #333; border: 2px solid #ccc; padding: 10px 20px; font-size: 16px; cursor: pointer; }
59
- .light-btn:hover { background-color: #e0e0e0; }
 
 
 
 
 
 
 
 
 
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