Spaces:
Runtime error
Runtime error
import streamlit as st | |
import openai | |
st.set_page_config(layout="wide") | |
st.title("Influencer Post Generator") | |
openai_key = st.text_input('Enter your openai API key...', type="password") | |
with st.form(key='columns_in_form'): | |
c1, c2, c3, c4, c5, c6 = st.columns(6) | |
with c1: | |
network = st.text_input('Which platform...') | |
with c2: | |
influencer_name = st.text_input('Enter your influencer name...') | |
with c3: | |
product_name = st.text_input('Enter your product name...') | |
with c4: | |
product_features = st.text_input('What features to highlight...') | |
with c5: | |
must_have = st.text_input('Must have these words...') | |
with c6: | |
target = st.text_input('Targeting these people...') | |
submitButton = st.form_submit_button(label="Surprise Me!", help="Click to see an example post!") | |
if openai_key: | |
openai.api_key = openai_key | |
if submitButton: | |
text = 'Image you are a {} influencer called {}, you need to write a post that promotes {} \ | |
which targets {} with emojis. I need you to highlight these features: {}, and must include these words: {}'.format(network, influencer_name, product_name, target, product_features, must_have) | |
completion = openai.ChatCompletion.create( | |
model="gpt-3.5-turbo", | |
messages=[{"role": "user", "content": text}]) | |
st.text_area(label ="",value=completion["choices"][0]["message"]["content"], height =300) | |