pn23 commited on
Commit
bf47ce6
·
verified ·
1 Parent(s): 47ab876

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -1
app.py CHANGED
@@ -1,6 +1,34 @@
1
  import streamlit as st
2
 
 
 
 
 
 
 
 
 
3
  # VIDEO_URL = "https://example.com/not-youtube.mp4"
4
  # st.video(VIDEO_URL)
5
 
6
- print('testing')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
 
3
+ import pathlib
4
+ import textwrap
5
+ import requests
6
+ import google.generativeai as genai
7
+ import json
8
+
9
+
10
+
11
  # VIDEO_URL = "https://example.com/not-youtube.mp4"
12
  # st.video(VIDEO_URL)
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))
33
+ print(lyrics)
34
+ print(genre)