Update app.py
Browse files
app.py
CHANGED
|
@@ -230,17 +230,42 @@ def convert_now(audio_files, random_tag, converter, type_output, steps):
|
|
| 230 |
return audio_files
|
| 231 |
|
| 232 |
def run(
|
| 233 |
-
audio_files,
|
| 234 |
-
|
| 235 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 236 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
if not audio_files:
|
| 238 |
raise ValueError("Please provide audio files")
|
|
|
|
| 239 |
if isinstance(audio_files, str):
|
| 240 |
audio_files = [audio_files]
|
| 241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
file_m, file_index = find_my_model(file_m, file_index)
|
|
|
|
|
|
|
| 243 |
random_tag = "USER_" + str(random.randint(10000000, 99999999))
|
|
|
|
| 244 |
converter.apply_conf(
|
| 245 |
tag=random_tag,
|
| 246 |
file_model=file_m,
|
|
@@ -254,11 +279,15 @@ def run(
|
|
| 254 |
resample_sr=0,
|
| 255 |
)
|
| 256 |
time.sleep(0.1)
|
|
|
|
| 257 |
result = convert_now(audio_files, random_tag, converter, type_output, steps)
|
|
|
|
| 258 |
if active_noise_reduce:
|
| 259 |
result = apply_noisereduce(result, type_output)
|
|
|
|
| 260 |
if audio_effects:
|
| 261 |
result = add_audio_effects(result, type_output)
|
|
|
|
| 262 |
return result
|
| 263 |
|
| 264 |
# ========== UI कम्पोनेंट ==========
|
|
|
|
| 230 |
return audio_files
|
| 231 |
|
| 232 |
def run(
|
| 233 |
+
audio_files,
|
| 234 |
+
file_m,
|
| 235 |
+
pitch_alg,
|
| 236 |
+
pitch_lvl,
|
| 237 |
+
file_index,
|
| 238 |
+
index_inf,
|
| 239 |
+
r_m_f,
|
| 240 |
+
e_r,
|
| 241 |
+
c_b_p,
|
| 242 |
+
active_noise_reduce,
|
| 243 |
+
audio_effects,
|
| 244 |
+
type_output,
|
| 245 |
+
steps,
|
| 246 |
):
|
| 247 |
+
# डीबग जानकारी प्रिंट करें
|
| 248 |
+
print("DEBUG: file_m =", file_m)
|
| 249 |
+
print("DEBUG: file_index =", file_index)
|
| 250 |
+
|
| 251 |
if not audio_files:
|
| 252 |
raise ValueError("Please provide audio files")
|
| 253 |
+
|
| 254 |
if isinstance(audio_files, str):
|
| 255 |
audio_files = [audio_files]
|
| 256 |
+
|
| 257 |
+
try:
|
| 258 |
+
duration_base = librosa.get_duration(filename=audio_files[0])
|
| 259 |
+
print("Duration:", duration_base)
|
| 260 |
+
except Exception as e:
|
| 261 |
+
print(e)
|
| 262 |
+
|
| 263 |
+
if file_m is not None and file_m.endswith(".txt"):
|
| 264 |
file_m, file_index = find_my_model(file_m, file_index)
|
| 265 |
+
print(file_m, file_index)
|
| 266 |
+
|
| 267 |
random_tag = "USER_" + str(random.randint(10000000, 99999999))
|
| 268 |
+
|
| 269 |
converter.apply_conf(
|
| 270 |
tag=random_tag,
|
| 271 |
file_model=file_m,
|
|
|
|
| 279 |
resample_sr=0,
|
| 280 |
)
|
| 281 |
time.sleep(0.1)
|
| 282 |
+
|
| 283 |
result = convert_now(audio_files, random_tag, converter, type_output, steps)
|
| 284 |
+
|
| 285 |
if active_noise_reduce:
|
| 286 |
result = apply_noisereduce(result, type_output)
|
| 287 |
+
|
| 288 |
if audio_effects:
|
| 289 |
result = add_audio_effects(result, type_output)
|
| 290 |
+
|
| 291 |
return result
|
| 292 |
|
| 293 |
# ========== UI कम्पोनेंट ==========
|