Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,8 @@ import gradio as gr
|
|
2 |
import os
|
3 |
import allin1
|
4 |
import time
|
|
|
|
|
5 |
|
6 |
from pathlib import Path
|
7 |
|
@@ -103,7 +105,34 @@ def analyze(path):
|
|
103 |
#return result.bpm, fig, sonif_path, elapsed_time
|
104 |
return result.bpm, fig, elapsed_time, json_structure_output, bass_path, drums_path, other_path, vocals_path
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
|
|
|
|
|
|
|
|
|
|
107 |
with gr.Blocks() as demo:
|
108 |
gr.HTML(HEADER)
|
109 |
|
|
|
2 |
import os
|
3 |
import allin1
|
4 |
import time
|
5 |
+
import json
|
6 |
+
import torch
|
7 |
|
8 |
from pathlib import Path
|
9 |
|
|
|
105 |
#return result.bpm, fig, sonif_path, elapsed_time
|
106 |
return result.bpm, fig, elapsed_time, json_structure_output, bass_path, drums_path, other_path, vocals_path
|
107 |
|
108 |
+
def add_voice_label(json_file, audio_path):
|
109 |
+
# Load the JSON file
|
110 |
+
file_path = 'path_to_your_json_file.json'
|
111 |
+
with open(file_path, 'r') as f:
|
112 |
+
data = json.load(f)
|
113 |
+
|
114 |
+
# Access the segments
|
115 |
+
segments = data['segments']
|
116 |
+
|
117 |
+
times = []
|
118 |
+
for segment in segments:
|
119 |
+
start = segment['start']
|
120 |
+
end = segment['end']
|
121 |
+
|
122 |
+
audio_segment = get_audio_segment()
|
123 |
+
|
124 |
+
|
125 |
+
|
126 |
+
|
127 |
+
# Add the "voice" label to each segment. It contains either Yes or No.
|
128 |
+
for segment in segments:
|
129 |
+
segment['voice'] = contains_voice(segment)
|
130 |
|
131 |
+
|
132 |
+
def get_audio_segment(audio_path, ):
|
133 |
+
|
134 |
+
|
135 |
+
|
136 |
with gr.Blocks() as demo:
|
137 |
gr.HTML(HEADER)
|
138 |
|