TheStinger commited on
Commit
603337f
·
1 Parent(s): ee5d4cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -10,10 +10,10 @@ def main():
10
  gr.Markdown(
11
  """
12
  # <div align="center"> Ilaria Audio Analyzer 💖 (BETA) </div>
13
- Audio Analyzer Software by Ilaria, Help me on Ko-Fi\n
14
- Special thanks to Alex Murkoff for helping me coding it!
15
 
16
- Need help with AI? Join AI Hub!
17
  """
18
  )
19
 
@@ -57,19 +57,26 @@ def create_spectrogram_and_get_info(audio_file):
57
  seconds, milliseconds = divmod(seconds, 1)
58
  milliseconds *= 1000 # convert from seconds to milliseconds
59
 
60
- # Convert bitrate to Mb/s
61
  bitrate = audio_info.samplerate * audio_info.channels * bit_depth / 8 / 1024 / 1024
62
 
 
 
 
63
  # Create a table with the audio file info
64
  info_table = f"""
 
65
 
66
  | Information | Value |
67
- | --- | --- |
68
  | File Name | {os.path.basename(audio_file)} |
69
  | Duration | {int(minutes)} minutes - {int(seconds)} seconds - {int(milliseconds)} milliseconds |
70
  | Samples per second | {audio_info.samplerate} Hz |
71
  | Audio Channels | {audio_info.channels} |
72
- | Bitrate | {bitrate:.2f} Mb/s |
 
 
 
73
  """
74
 
75
  # Return the PNG file of the spectrogram and the info table
 
10
  gr.Markdown(
11
  """
12
  # <div align="center"> Ilaria Audio Analyzer 💖 (BETA) </div>
13
+ Audio Analyzer Software by Ilaria, Help me on [Ko-Fi](https://ko-fi.com/ilariaowo)\n
14
+ Special thanks to [Alex Murkoff](https://github.com/alexlnkp) for helping me coding it!
15
 
16
+ Need help with AI? [Join AI Hub!](https://discord.gg/aihub)
17
  """
18
  )
19
 
 
57
  seconds, milliseconds = divmod(seconds, 1)
58
  milliseconds *= 1000 # convert from seconds to milliseconds
59
 
60
+ # Convert bitrate to mb/s
61
  bitrate = audio_info.samplerate * audio_info.channels * bit_depth / 8 / 1024 / 1024
62
 
63
+ # Calculate speed in kbps
64
+ speed_in_kbps = audio_info.samplerate * bit_depth / 1000
65
+
66
  # Create a table with the audio file info
67
  info_table = f"""
68
+ <center>
69
 
70
  | Information | Value |
71
+ | :---: | :---: |
72
  | File Name | {os.path.basename(audio_file)} |
73
  | Duration | {int(minutes)} minutes - {int(seconds)} seconds - {int(milliseconds)} milliseconds |
74
  | Samples per second | {audio_info.samplerate} Hz |
75
  | Audio Channels | {audio_info.channels} |
76
+ | Bitrate | {bitrate:.2f} mb/s |
77
+ | Speed | {speed_in_kbps} kbp/s |
78
+
79
+ </center>
80
  """
81
 
82
  # Return the PNG file of the spectrogram and the info table