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

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -23
app.py CHANGED
@@ -47,22 +47,22 @@ if "messages" not in st.session_state:
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)
@@ -70,18 +70,10 @@ def init_model(user_input):
70
  # whollySplit = sepTen.split("|")
71
 
72
 
73
- #generate_audio(lyrics, genre, title)
74
 
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")
 
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)
 
70
  # whollySplit = sepTen.split("|")
71
 
72
 
73
+ generate_audio(lyrics, genre, title)
74
 
75
  #make API request
76
+ audiourl = getSongUrl(title)
 
 
 
 
 
 
 
 
77
 
78
  #call webscraping script
79
  #get_mp3("Samba Kickoff")