Commit ·
3e809b7
1
Parent(s): b348565
Update app.py
Browse files12345678910111213141516171819202122232425import streamlit as stimport openai# OpenAI API Key Setupopenai.api_key = st.secrets["OPENAI_API_KEY"]st.title("Holiday Video Script Generator for Real Estate Agents")# Collecting User Inputsagent_name = st.text_input("Your Name")agency_name = st.text_input("Your Agency")target_audience = st.text_input("Target Audience")video_type = st.selectbox("Type of Video", ["Community Engagement", "Personalized Messages", "Local Highlights", "Market Insights", "Year in Review", "Home Decoration/Staging Tips"])personal_anecdotes = st.text_area("Personal Anecdotes/Success Stories")local_features = st.text_area("Local Community Features")market_statistics = st.text_area("Real Estate Market Statistics")if st.button('Generate Script'):user_input = f"Generate a one-minute holiday video script for a real estate agent. Agent's Name: {agent_name}. Agency: {agency_name}. Target Audience: {target_audience}. Video Type: {video_type}. Include: {personal_anecdotes}, {local_features}, {market_statistics}."response = openai.Completion.create(model="gpt-4",prompt=user_input,max_tokens=500)st.write(response.choices[0].text)1234567891011121314151617181920212223242526272829303132import streamlit as stimport openai# Access the OpenAI API key from Hugging Face Spaces secretsopenai.api_key = st.secrets["OPENAI_API_KEY"]st.title("Holiday Video Script Generator for Realtors")# User inputsagent_name = st.text_input("Your Name", placeholder="Enter your name")community_focus = st.text_input("Community Focus", placeholder="Enter the community or area you focus on")holiday_theme = st.selectbox("Holiday Theme", ["Christmas", "Hanukkah", "New Year's", "General Holiday Season"])personal_message = st.text_area("Personal Message", placeholder="Enter any personal message or story you want to include")if st.button('Generate Script'):# Formulate the user input for the scriptuser_input = (f"""You are an AI assistant that helps real estate agents create compelling holiday video scripts. The script should be festive, engaging, and approximately one minute long. Include elements like community engagement, local highlights, market insights, home decoration tips, and a personalized message. The agent's name is {agent_name}. They focus on the {community_focus} community. The holiday theme is {holiday_theme}. They want to include the following personal message: {personal_message}.""")# Call the OpenAI API with the chat modelresponse = openai.ChatCompletion.create(model="gpt-4", # Use the appropriate GPT-4 modelmessages=[{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": user_input}])# Display the response from the APIst.write(response.choices[0].message['content'])
app.py+23-16