Spaces:
Runtime error
Runtime error
Commit
·
c1ac4a6
1
Parent(s):
aecd61d
Update app.py
Browse files
app.py
CHANGED
@@ -1 +1,24 @@
|
|
1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import openai
|
3 |
+
|
4 |
+
st.title("Influencer Post Generator")
|
5 |
+
|
6 |
+
openai_key = st.text_input('Enter your openai API key...', type="password")
|
7 |
+
network = st.text_input('Which platform...')
|
8 |
+
influencer_name = st.text_input('Enter your influencer name...')
|
9 |
+
product_name = st.text_input('Enter your product name...')
|
10 |
+
product_features = st.text_input('What features you want to highlight...')
|
11 |
+
must_have = st.text_input('Must have these words...')
|
12 |
+
target = st.text_input('Targeting these people...')
|
13 |
+
|
14 |
+
if openai_key:
|
15 |
+
openai.api_key = openai_key
|
16 |
+
|
17 |
+
if network and influencer_name and product_name and must_have and target and st.button("Predict"):
|
18 |
+
text = 'Image you are a {} influencer called {}, you need to write a post that promotes {} \
|
19 |
+
which targets {}. I need you to highlight these features: {}, and must include these words: {}'.format(network, influencer_name, product_name, target, product_features, must_have)
|
20 |
+
completion = openai.ChatCompletion.create(
|
21 |
+
model="gpt-3.5-turbo",
|
22 |
+
messages=[{"role": "user", "content": text}])
|
23 |
+
out = completion["choices"][0]["message"]["content"]
|
24 |
+
st.json(out)
|