import streamlit as st import os import openai # Set your OpenAI API key openai.api_key = ('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') st.title("Lyrics Generator") # Input text box for user input user_input = st.text_area("Enter a word for which you want the lyrics for:") if user_input: # Generate a corrected response response = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[{"role": "system", "content": "You are a helpful assistant that makes song lyrics for given word."}, { "role": "user", "content": user_input}], temperature=0.7, max_tokens=2000 # You can adjust this for the desired response length ) # Extract and display the assistant's reply assistant_reply = response['choices'][0]['message']['content'] st.write("Here the song is:") st.write(assistant_reply) else: print("Please gives us an input in order to work! Thanks.")