Spaces:
Sleeping
Sleeping
Upload myinfer_latest.py
Browse files29 unmodified lines3031323333343536238 unmodified lines27527627727827927928028128228328428528628719 unmodified lines30730830930531031131231338 unmodified lines35235335435535635735835929 unmodified linesfrom pydub import AudioSegmentfrom flask_dance.contrib.google import make_google_blueprint, googleimport iofrom space import list_modelsfrom space import ensure_model_in_weights_dir,upload_to_doimport boto3
238 unmodified lines if file.content_length > 10 * 1024 * 1024: return jsonify({"error": "File size exceeds 6 MB"}), 400 print("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_extension ensure_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()) #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}), 200 finally: request_semaphore.release()myinfer_latest.py+10-3