import requests # Define the API endpoint url = "https://mmesa-websutmmit2024.onrender.com/analyze-stress/" # Path to the audio file you want to analyze file_path = "../assets/audio/fitness.wav" # Open the file in binary mode and send the request with open(file_path, "rb") as audio_file: files = {"file": ("audio.wav", audio_file, "audio/wav")} response = requests.post(url, files=files) # Check if the request was successful if response.status_code == 200: result = response.json() print("Stress Level:", result["stress_level"]) print("Category:", result["category"]) print("Gender:", result["gender"]) else: print("Error:", response.status_code, response.text)