Spaces:
Sleeping
Sleeping
File size: 853 Bytes
4167242 b54ee73 4167242 b54ee73 a6c6fc6 b54ee73 4167242 b4c356f b54ee73 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import streamlit as st
import requests
# Replace with your actual API URL and key
API_URL = "API_URL = "https://api.musictherapysite.com/v1/generate" # Example URL
API_KEY = "gsk_...zzDm"
# Define Streamlit app layout
st.title("Personalized Healing Songs Generator")
prompt = st.text_area("Enter your emotional or therapeutic needs:")
if st.button("Generate Song"):
if prompt:
headers = {"Authorization": f"Bearer {API_KEY}"}
payload = {"prompt": prompt, "max_length": 150}
response = requests.post(API_URL, headers=headers, json=payload)
if response.status_code == 200:
result = response.json()
st.write(result['generated_text'].strip())
else:
st.error(f"Error: {response.status_code} - {response.text}")
else:
st.error("Please enter a prompt.")
|