Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -34,12 +34,12 @@ if "messages" not in st.session_state:
|
|
| 34 |
|
| 35 |
init_alr = False
|
| 36 |
|
| 37 |
-
def init_model():
|
| 38 |
os.environ["API_KEY"] = "AIzaSyCADQk7KaP90mSKslhtEC3qRjyeUVxBkvI"
|
| 39 |
genai.configure(api_key=os.environ.get("API_KEY"))
|
| 40 |
model = genai.GenerativeModel('gemini-pro')
|
| 41 |
|
| 42 |
-
userInput = "Give me an afrofunk beat along with a cool melody and catchy drums, along with an opera style"
|
| 43 |
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>"
|
| 44 |
response = model.generate_content(prompt)
|
| 45 |
genre = response.text
|
|
@@ -65,7 +65,7 @@ if prompt := st.chat_input():
|
|
| 65 |
if init_alr == False:
|
| 66 |
init_alr = True
|
| 67 |
|
| 68 |
-
genre = init_model()
|
| 69 |
#Call query generator with text_input
|
| 70 |
#query = prompty(date_input, prompt)
|
| 71 |
#result = qa({"query": query})
|
|
|
|
| 34 |
|
| 35 |
init_alr = False
|
| 36 |
|
| 37 |
+
def init_model(user_input):
|
| 38 |
os.environ["API_KEY"] = "AIzaSyCADQk7KaP90mSKslhtEC3qRjyeUVxBkvI"
|
| 39 |
genai.configure(api_key=os.environ.get("API_KEY"))
|
| 40 |
model = genai.GenerativeModel('gemini-pro')
|
| 41 |
|
| 42 |
+
userInput = user_input #"Give me an afrofunk beat along with a cool melody and catchy drums, along with an opera style"
|
| 43 |
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>"
|
| 44 |
response = model.generate_content(prompt)
|
| 45 |
genre = response.text
|
|
|
|
| 65 |
if init_alr == False:
|
| 66 |
init_alr = True
|
| 67 |
|
| 68 |
+
genre = init_model(prompt)
|
| 69 |
#Call query generator with text_input
|
| 70 |
#query = prompty(date_input, prompt)
|
| 71 |
#result = qa({"query": query})
|