eve / music.py
Chandima Prabhath
Refactor route_intent function to enhance system prompt clarity and update command descriptions; add music generation functionality
da0b02a
raw
history blame contribute delete
668 Bytes
import requests
from dotenv import load_dotenv
import os
load_dotenv()
_CHUTES_API_KEY = os.getenv("CHUTES_API_KEY")
def generate_music(prompt, lyrics=None, audio_b64=None):
api_token = _CHUTES_API_KEY
headers = {
"Authorization": "Bearer " + api_token,
"Content-Type": "application/json"
}
body = {
"style_prompt": prompt,
"lyrics": lyrics,
"audio_b64": audio_b64
}
response = requests.post(
"https://chutes-diffrhythm.chutes.ai/generate",
headers=headers,
json=body
)
# Print status code and response
print(f"Status code: {response.status_code}")
print(response.json())
generate_music("a happy children song")