Spaces:
Sleeping
Sleeping
Upload myinfer_latest.py
Browse files29 unmodified lines30313233343536238 unmodified lines27527627727827928028128219 unmodified lines30230330430530630730838 unmodified lines34734834935035135229 unmodified linesfrom pydub import AudioSegmentfrom flask_dance.contrib.google import make_google_blueprint, googleimport iofrom space import list_modelsimport boto3238 unmodified linesif file.content_length > 10 * 1024 * 1024:return jsonify({"error": "File size exceeds 6 MB"}), 400print("after file access")content_type_format_map = {'audio/mpeg': 'mp3','audio/wav': 'wav',19 unmodified lines#created_files = []# Save the file to a temporary pathunique_id = str(uuid.uuid4())print(unique_id)filename = werkzeug.utils.secure_filename(file.filename)38 unmodified lines#created_files.extend([vocal_path, inst, output_path])task_status_tracker[unique_id]["status"] = "Completed"return jsonify({"message": "File processed successfully", "audio_id": unique_id}), 200finally:request_semaphore.release()29 unmodified lines30313233343536238 unmodified lines27527627727827928028128228328428528628719 unmodified lines30730830931031131231338 unmodified lines35235335435535635735835929 unmodified linesfrom pydub import AudioSegmentfrom flask_dance.contrib.google import make_google_blueprint, googleimport iofrom space import ensure_model_in_weights_dir,upload_to_doimport boto3238 unmodified linesif file.content_length > 10 * 1024 * 1024:return jsonify({"error": "File size exceeds 6 MB"}), 400print("after file access")print("check if model is there in weights dir or not")filename_without_extension = os.path.splitext(file.filename)[0]unique_id = filename_without_extensionensure_model_in_weights_dir(spk_id)print("checking done for the model")content_type_format_map = {'audio/mpeg': 'mp3','audio/wav': 'wav',19 unmodified lines#created_files = []# Save the file to a temporary path#unique_id = str(uuid.uuid4())print(unique_id)filename = werkzeug.utils.secure_filename(file.filename)38 unmodified lines#created_files.extend([vocal_path, inst, output_path])task_status_tracker[unique_id]["status"] = "Completed"upload_to_do()return jsonify({"message": "File processed successfully", "audio_id": unique_id}), 200finally:request_semaphore.release()
myinfer_latest.py+10-3