Spaces:
Running
Running
Upload myinfer_latest.py
Browse files- myinfer_latest.py +10 -3
myinfer_latest.py
CHANGED
@@ -30,7 +30,7 @@ from queue import Empty
|
|
30 |
from pydub import AudioSegment
|
31 |
from flask_dance.contrib.google import make_google_blueprint, google
|
32 |
import io
|
33 |
-
from space import
|
34 |
import boto3
|
35 |
|
36 |
|
@@ -275,8 +275,13 @@ def api_convert_voice():
|
|
275 |
|
276 |
if file.content_length > 10 * 1024 * 1024:
|
277 |
return jsonify({"error": "File size exceeds 6 MB"}), 400
|
|
|
278 |
print("after file access")
|
279 |
-
|
|
|
|
|
|
|
|
|
280 |
content_type_format_map = {
|
281 |
'audio/mpeg': 'mp3',
|
282 |
'audio/wav': 'wav',
|
@@ -302,7 +307,7 @@ def api_convert_voice():
|
|
302 |
|
303 |
#created_files = []
|
304 |
# Save the file to a temporary path
|
305 |
-
unique_id = str(uuid.uuid4())
|
306 |
print(unique_id)
|
307 |
|
308 |
filename = werkzeug.utils.secure_filename(file.filename)
|
@@ -347,6 +352,8 @@ def api_convert_voice():
|
|
347 |
|
348 |
#created_files.extend([vocal_path, inst, output_path])
|
349 |
task_status_tracker[unique_id]["status"] = "Completed"
|
|
|
|
|
350 |
return jsonify({"message": "File processed successfully", "audio_id": unique_id}), 200
|
351 |
finally:
|
352 |
request_semaphore.release()
|
|
|
30 |
from pydub import AudioSegment
|
31 |
from flask_dance.contrib.google import make_google_blueprint, google
|
32 |
import io
|
33 |
+
from space import ensure_model_in_weights_dir,upload_to_do
|
34 |
import boto3
|
35 |
|
36 |
|
|
|
275 |
|
276 |
if file.content_length > 10 * 1024 * 1024:
|
277 |
return jsonify({"error": "File size exceeds 6 MB"}), 400
|
278 |
+
|
279 |
print("after file access")
|
280 |
+
print("check if model is there in weights dir or not")
|
281 |
+
filename_without_extension = os.path.splitext(file.filename)[0]
|
282 |
+
unique_id = filename_without_extension
|
283 |
+
ensure_model_in_weights_dir(spk_id)
|
284 |
+
print("checking done for the model")
|
285 |
content_type_format_map = {
|
286 |
'audio/mpeg': 'mp3',
|
287 |
'audio/wav': 'wav',
|
|
|
307 |
|
308 |
#created_files = []
|
309 |
# Save the file to a temporary path
|
310 |
+
#unique_id = str(uuid.uuid4())
|
311 |
print(unique_id)
|
312 |
|
313 |
filename = werkzeug.utils.secure_filename(file.filename)
|
|
|
352 |
|
353 |
#created_files.extend([vocal_path, inst, output_path])
|
354 |
task_status_tracker[unique_id]["status"] = "Completed"
|
355 |
+
upload_to_do()
|
356 |
+
|
357 |
return jsonify({"message": "File processed successfully", "audio_id": unique_id}), 200
|
358 |
finally:
|
359 |
request_semaphore.release()
|