mobenta commited on
Commit
323fa8a
1 Parent(s): 30d2e4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -28,17 +28,31 @@ def compress_audio(input_audio_path, compression_rate=128, output_name="compress
28
  except Exception as e:
29
  return str(e)
30
 
31
- # Create the Gradio app
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  interface = gr.Interface(
33
  fn=compress_audio,
34
  inputs=[
35
- gr.Audio(label="Upload Audio File", type="filepath"),
36
  gr.Slider(32, 320, step=16, label="Compression Rate (kbps)", value=128),
37
  gr.Textbox(label="Output File Name", placeholder="compressed_audio.mp3"),
38
  ],
39
  outputs=gr.File(label="Download Compressed Audio"),
40
  title="Audio Compressor",
41
  description="Upload an audio file, set the compression rate, and specify a name for the compressed file.",
 
42
  allow_flagging="never",
43
  )
44
 
 
28
  except Exception as e:
29
  return str(e)
30
 
31
+ # Custom CSS for better mobile layout
32
+ custom_css = """
33
+ #interface-container {
34
+ max-width: 100%;
35
+ margin: auto;
36
+ padding: 10px;
37
+ font-family: Arial, sans-serif;
38
+ }
39
+ .audio {
40
+ max-width: 100%;
41
+ }
42
+ """
43
+
44
+ # Create the Gradio app with improved layout
45
  interface = gr.Interface(
46
  fn=compress_audio,
47
  inputs=[
48
+ gr.Audio(label="Upload Audio File", type="filepath", elem_id="audio-input"),
49
  gr.Slider(32, 320, step=16, label="Compression Rate (kbps)", value=128),
50
  gr.Textbox(label="Output File Name", placeholder="compressed_audio.mp3"),
51
  ],
52
  outputs=gr.File(label="Download Compressed Audio"),
53
  title="Audio Compressor",
54
  description="Upload an audio file, set the compression rate, and specify a name for the compressed file.",
55
+ css=custom_css,
56
  allow_flagging="never",
57
  )
58