shallou commited on
Commit
4167242
·
verified ·
1 Parent(s): 77bc5bc

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +31 -0
app.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import openai
3
+
4
+ # Configure OpenAI API key
5
+ openai.api_key = st.secrets["OPENAI_API_KEY"]
6
+
7
+ def generate_lyrics(prompt):
8
+ response = openai.Completion.create(
9
+ engine="text-davinci-003",
10
+ prompt=prompt,
11
+ max_tokens=150,
12
+ temperature=0.7
13
+ )
14
+ return response.choices[0].text.strip()
15
+
16
+ # Streamlit app
17
+ st.title("Personalized Healing Songs")
18
+
19
+ st.write("Enter your emotional or therapeutic needs below, and receive a personalized set of lyrics generated by AI.")
20
+
21
+ # Input section
22
+ emotional_need = st.text_input("Describe your emotional or therapeutic needs:")
23
+
24
+ if st.button("Generate Lyrics"):
25
+ if emotional_need:
26
+ prompt = f"Generate calming or uplifting lyrics tailored to the following emotional or therapeutic need: {emotional_need}"
27
+ lyrics = generate_lyrics(prompt)
28
+ st.write("Here are your personalized healing lyrics:")
29
+ st.write(lyrics)
30
+ else:
31
+ st.error("Please enter a description of your emotional or therapeutic needs.")