pn23 commited on
Commit
c44c1cb
·
verified ·
1 Parent(s): d0407f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -15
app.py CHANGED
@@ -13,20 +13,7 @@ import os
13
 
14
 
15
 
16
- genai.configure(api_key="AIzaSyCADQk7KaP90mSKslhtEC3qRjyeUVxBkvI")
17
- model = genai.GenerativeModel('gemini-pro')
18
 
19
- userInput = "Give me an afrofunk beat along with a cool melody and catchy drums, along with an opera style"
20
- prompt = userInput + ". Output ONLY the specific music genre that the user would like that fits their requirements, with no excess words. Simply the genre, NO APOSTROPHES. If required, add more than one genre to best fit the user's prompt by adding a comma and space and a another genre. Desired Output: <all_lowercase_comma_separated_genres>"
21
- response = model.generate_content(prompt)
22
- genre = response.text
23
-
24
- userInput = "Genre: " + genre + ". Generate lyrics that would best fit into the required genre. The lyrics should not be about the genre, but would best fit into the genre. Generate around 1 minutes worth of lyrics. Separate verses using [Verse #] and NO APOSTROPHES AT ALL. If you must use them, please remove them from the word, even if it mispells the word. Desired Format: <seperate_each_verse_no_asteriks_or_apostrophes>"
25
- response = model.generate_content(userInput)
26
- lyrics = response.text
27
-
28
- lyricInput = "Lyrics: " + lyrics + ". Based upon the following lyrics, please generate a title for this song. Desired Format: <title_case_without_genre>"
29
- response = model.generate_content(lyricInput)
30
  title = response.text
31
 
32
  # print(str(title))
@@ -50,5 +37,41 @@ if "messages" not in st.session_state:
50
  init_alr = False
51
 
52
  def init_model():
53
- return
54
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
 
15
 
 
 
16
 
 
 
 
 
 
 
 
 
 
 
 
17
  title = response.text
18
 
19
  # print(str(title))
 
37
  init_alr = False
38
 
39
  def init_model():
40
+ os.environ["API_KEY"] = "AIzaSyCADQk7KaP90mSKslhtEC3qRjyeUVxBkvI"
41
+ genai.configure(api_key=os.environ.get("API_KEY"))
42
+ model = genai.GenerativeModel('gemini-pro')
43
+
44
+ userInput = "Give me an afrofunk beat along with a cool melody and catchy drums, along with an opera style"
45
+ prompt = userInput + ". Output ONLY the specific music genre that the user would like that fits their requirements, with no excess words. Simply the genre, NO APOSTROPHES. If required, add more than one genre to best fit the user's prompt by adding a comma and space and a another genre. Desired Output: <all_lowercase_comma_separated_genres>"
46
+ response = model.generate_content(prompt)
47
+ genre = response.text
48
+
49
+ userInput = "Genre: " + genre + ". Generate lyrics that would best fit into the required genre. The lyrics should not be about the genre, but would best fit into the genre. Generate around 1 minutes worth of lyrics. Separate verses using [Verse #] and NO APOSTROPHES AT ALL. If you must use them, please remove them from the word, even if it mispells the word. Desired Format: <seperate_each_verse_no_asteriks_or_apostrophes>"
50
+ response = model.generate_content(userInput)
51
+ lyrics = response.text
52
+
53
+ lyricInput = "Lyrics: " + lyrics + ". Based upon the following lyrics, please generate a title for this song. Desired Format: <title_case_without_genre>"
54
+ response = model.generate_content(lyricInput)
55
+
56
+ return genre
57
+
58
+ st_callback = StreamlitCallbackHandler(st.container())
59
+
60
+ date_input = st.text_input(label = "Enter Date (ex. 10-11) 👇"
61
+
62
+
63
+ if prompt := st.chat_input():
64
+ st.chat_message("user").write(prompt)
65
+ with st.chat_message("assistant"):
66
+ #st_callback = StreamlitCallbackHandler(st.container())
67
+
68
+ if init_alr == False:
69
+ init_alr = True
70
+
71
+ genre = init_model()
72
+ #Call query generator with text_input
73
+ #query = prompty(date_input, prompt)
74
+ #result = qa({"query": query})
75
+
76
+ st.write(genre)
77
+ st.stop()