pn23 commited on
Commit
f58525e
·
verified ·
1 Parent(s): 5810bb5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -15
app.py CHANGED
@@ -5,6 +5,7 @@ import textwrap
5
  import requests
6
  import google.generativeai as genai
7
  import json
 
8
 
9
 
10
 
@@ -46,22 +47,22 @@ if "messages" not in st.session_state:
46
  init_alr = False
47
 
48
  def init_model(user_input):
49
- os.environ["API_KEY"] = "AIzaSyAgqODyVqcqlsDC1Gzuy8TkpiWnQZVGovw"
50
- genai.configure(api_key=os.environ.get("API_KEY"))
51
- model = genai.GenerativeModel('gemini-pro')
52
 
53
- userInput = user_input #"Give me an afrofunk beat along with a cool melody and catchy drums, along with an opera style"
54
- prompt = userInput + ". Output ONLY the specific music genre that the user would like that fits their requirements, with no excess words. NO APOSTROPHES. Add more than one genre to best fit the user's prompt. Desired Output: <all_lowercase_comma_separated_genres>"
55
- response = model.generate_content(prompt)
56
- genre = response.text
57
 
58
- userInput = "Genre: " + genre + ". Generate lyrics that would best fit into the required genre. Generate around 2 minutes worth of lyrics. Separate verses using [Verse #] and NO APOSTROPHES AT ALL. Desired Format: <seperate_each_verse_no_asteriks_or_apostrophes>"
59
- response = model.generate_content(userInput)
60
- lyrics = response.text
61
 
62
- lyricInput = "Lyrics: " + lyrics[:25] + ". Based upon the following lyrics, please generate a title for this song. Desired Format: <title_case_without_genre>"
63
- response = model.generate_content(lyricInput)
64
- title = response.text
65
 
66
  # userInput = "Lyrics: " + lyrics + ". Split the following lyrics into ONLY 10 slices with each slice enhanced to describe a music video. You may slightlly alter the lyrics to best cater to this requirment. Each section is separated by a |. Use only 10 |'s. Delete ALL \n characters and Verse seperators as well. Desired Output: <|_separated>"
67
  # response = model.generate_content(userInput)
@@ -74,7 +75,13 @@ def init_model(user_input):
74
  #make API request
75
  #audiourl = getSongUrl(title)
76
 
77
- audiourl = "google.com"
 
 
 
 
 
 
78
 
79
  #call webscraping script
80
  #get_mp3("Samba Kickoff")
@@ -101,5 +108,5 @@ if prompt := st.chat_input():
101
  st.write('Based on the interesting description you have provided, we will generate a ' + genre + ' music experience for you:')
102
  st.write('Title: ' + title)
103
  st.write('Lyrics: ' + lyrics)
104
- st.write('You can find the final generated audio file here: ' + audiourl)
105
  st.stop()
 
5
  import requests
6
  import google.generativeai as genai
7
  import json
8
+ import os
9
 
10
 
11
 
 
47
  init_alr = False
48
 
49
  def init_model(user_input):
50
+ # os.environ["API_KEY"] = "AIzaSyAgqODyVqcqlsDC1Gzuy8TkpiWnQZVGovw"
51
+ # genai.configure(api_key=os.environ.get("API_KEY"))
52
+ # model = genai.GenerativeModel('gemini-pro')
53
 
54
+ # userInput = user_input #"Give me an afrofunk beat along with a cool melody and catchy drums, along with an opera style"
55
+ # prompt = userInput + ". Output ONLY the specific music genre that the user would like that fits their requirements, with no excess words. NO APOSTROPHES. Add more than one genre to best fit the user's prompt. Desired Output: <all_lowercase_comma_separated_genres>"
56
+ # response = model.generate_content(prompt)
57
+ # genre = response.text
58
 
59
+ # userInput = "Genre: " + genre + ". Generate lyrics that would best fit into the required genre. Generate around 2 minutes worth of lyrics. Separate verses using [Verse #] and NO APOSTROPHES AT ALL. Desired Format: <seperate_each_verse_no_asteriks_or_apostrophes>"
60
+ # response = model.generate_content(userInput)
61
+ # lyrics = response.text
62
 
63
+ # lyricInput = "Lyrics: " + lyrics[:25] + ". Based upon the following lyrics, please generate a title for this song. Desired Format: <title_case_without_genre>"
64
+ # response = model.generate_content(lyricInput)
65
+ # title = response.text
66
 
67
  # userInput = "Lyrics: " + lyrics + ". Split the following lyrics into ONLY 10 slices with each slice enhanced to describe a music video. You may slightlly alter the lyrics to best cater to this requirment. Each section is separated by a |. Use only 10 |'s. Delete ALL \n characters and Verse seperators as well. Desired Output: <|_separated>"
68
  # response = model.generate_content(userInput)
 
75
  #make API request
76
  #audiourl = getSongUrl(title)
77
 
78
+ title = 'Realm of Whispers'
79
+ genre = 'afrofunk, opera'
80
+
81
+ lyrics = "[Verse 1]\nIn the realm where rhythms soar\nWhere funky beats ignite the core\nLike a cosmic dance, our spirits unite\nAs ancestral drums carry us through the night\n[Verse 2]\nAfrofunk's siren, a call so divine\nA symphony of souls, a musical shrine\nFrom Yoruba chants to Congolese grooves\nWe traverse the realms of mystical moves\n[Verse 3]\nVoices erupt in operatic splendor\nA timeless tapestry, a transcendent render\nEchoes of Verdi meet Fela's bold fire\nOpera's grandeur melds with funk's primal desire\n[Verse 4]\nIn this fusion of worlds, a cosmic delight\nWhere melodies soar to an ethereal height\nWe become vessels of musical ecstasy\nAfrofunk and opera, a symphony of majesty"
82
+
83
+
84
+ audiourl = "https://cdn1.suno.ai/c94802b4-5624-48ee-8e85-44837ae69e4a.mp4"
85
 
86
  #call webscraping script
87
  #get_mp3("Samba Kickoff")
 
108
  st.write('Based on the interesting description you have provided, we will generate a ' + genre + ' music experience for you:')
109
  st.write('Title: ' + title)
110
  st.write('Lyrics: ' + lyrics)
111
+ st.write('You can find the final generated mp4 file here: ' + audiourl)
112
  st.stop()