Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
import openai
|
2 |
-
import gradio
|
3 |
import os
|
|
|
4 |
from tenacity import retry, wait_fixed, stop_after_attempt
|
5 |
|
|
|
6 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
7 |
|
|
|
8 |
initial_messages = [{"role": "system", "content": """Please act as a marketing expert for real estate agents. Your role is
|
9 |
to generate topic summary ideas for social media videos. Follow these steps in this order:
|
10 |
1. Before you execute any steps, consider the last input from the user as a suggestion for the types of topics you should create if
|
@@ -27,17 +29,15 @@ def CustomChatGPT(user_input, messages):
|
|
27 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
28 |
return ChatGPT_reply, messages
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
reply, updated_messages = CustomChatGPT(user_input, messages)
|
35 |
-
|
36 |
-
# Replace the following line with your method to store the updated messages list for the current user
|
37 |
-
# Store updated_messages
|
38 |
|
39 |
-
|
|
|
40 |
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
1 |
import openai
|
|
|
2 |
import os
|
3 |
+
import streamlit as st
|
4 |
from tenacity import retry, wait_fixed, stop_after_attempt
|
5 |
|
6 |
+
# Set OpenAI API key from environment variables
|
7 |
openai.api_key = os.environ["OPENAI_API_KEY"]
|
8 |
|
9 |
+
# Define the initial system message
|
10 |
initial_messages = [{"role": "system", "content": """Please act as a marketing expert for real estate agents. Your role is
|
11 |
to generate topic summary ideas for social media videos. Follow these steps in this order:
|
12 |
1. Before you execute any steps, consider the last input from the user as a suggestion for the types of topics you should create if
|
|
|
29 |
messages.append({"role": "assistant", "content": ChatGPT_reply})
|
30 |
return ChatGPT_reply, messages
|
31 |
|
32 |
+
# Streamlit app setup
|
33 |
+
st.title("Video Idea Generator for Real Estate Agents")
|
34 |
+
st.write("Enter a topic suggestion or leave it blank for general video ideas.")
|
|
|
|
|
|
|
|
|
|
|
35 |
|
36 |
+
user_input = st.text_input("Enter a topic:")
|
37 |
+
generate_button = st.button("Generate Ideas")
|
38 |
|
39 |
+
if generate_button:
|
40 |
+
messages = initial_messages.copy()
|
41 |
+
reply, _ = CustomChatGPT(user_input, messages)
|
42 |
+
st.write("Here are the top video ideas:")
|
43 |
+
st.write(reply)
|