added new feature in misc tools
Browse files
app.py
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
import gradio as gr, glob, os, auditok, zipfile, wave, pytube.exceptions
|
2 |
from pytube import YouTube
|
3 |
from moviepy.editor import VideoFileClip
|
4 |
|
@@ -126,6 +126,12 @@ def split_wav_file(audiofileuploader, mindur2, maxdur2, name_for_split_files2):
|
|
126 |
os.remove(file2)
|
127 |
return f"File split successfully!\nCheck below for zipped files.\nAmount created: {len(audio_files)}", zip_file_name2
|
128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
129 |
with gr.Blocks(theme='NoCrypt/miku', title="Global Dataset Maker") as app:
|
130 |
gr.HTML(
|
131 |
"<h1> Welcome to the GDMGS! (GlobalDatasetMaker Gradio Space) </h1>"
|
@@ -190,4 +196,18 @@ with gr.Blocks(theme='NoCrypt/miku', title="Global Dataset Maker") as app:
|
|
190 |
[audiofileuploader, mindur2, maxdur2, name_for_split_files2],
|
191 |
[gr.Text(label="Output"), gr.File(label="Zipped files")]
|
192 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
app.launch()
|
|
|
1 |
+
import gradio as gr, glob, os, auditok, zipfile, wave, pytube.exceptions, librosa
|
2 |
from pytube import YouTube
|
3 |
from moviepy.editor import VideoFileClip
|
4 |
|
|
|
126 |
os.remove(file2)
|
127 |
return f"File split successfully!\nCheck below for zipped files.\nAmount created: {len(audio_files)}", zip_file_name2
|
128 |
|
129 |
+
def get_average_pitch(audio_file):
|
130 |
+
y, sr = librosa.load(audio_file, sr=None)
|
131 |
+
pitches, magnitudes = librosa.piptrack(y=y, sr=sr)
|
132 |
+
mean_pitch = pitches.mean()
|
133 |
+
return f"Average pitch: {mean_pitch:.2f} Hz"
|
134 |
+
|
135 |
with gr.Blocks(theme='NoCrypt/miku', title="Global Dataset Maker") as app:
|
136 |
gr.HTML(
|
137 |
"<h1> Welcome to the GDMGS! (GlobalDatasetMaker Gradio Space) </h1>"
|
|
|
196 |
[audiofileuploader, mindur2, maxdur2, name_for_split_files2],
|
197 |
[gr.Text(label="Output"), gr.File(label="Zipped files")]
|
198 |
)
|
199 |
+
with gr.Tab("Pitch analyzer"):
|
200 |
+
gr.Markdown("Upload a wav file here, and this will determine the average pitch.")
|
201 |
+
gr.HTML("<h1> Zip files are not supported as of now.")
|
202 |
+
with gr.Row():
|
203 |
+
with gr.Column(variant='compact'):
|
204 |
+
with gr.Row():
|
205 |
+
upload = gr.File(file_count='single', file_types=[".wav"], label="WAV file")
|
206 |
+
analyze = gr.Button("Analyze", variant='primary')
|
207 |
+
analyze.click(
|
208 |
+
get_average_pitch,
|
209 |
+
[upload],
|
210 |
+
[gr.Text(label="Result")]
|
211 |
+
)
|
212 |
+
|
213 |
app.launch()
|