Commit ·
175d43a
1
Parent(s): 3cd9850
Update app.py
Browse files123456789101112131415161718192021222324252627282930313233343536373839import streamlit as stimport openai# Access the OpenAI API key from Hugging Face Spaces secretsopenai.api_key = st.secrets["YOUR_OPENAI_API_KEY"]st.title("Holiday Video Script Generator for Real Estate Agents")# User inputsagent_name = st.text_input("Your Name", placeholder="Enter your name")local_area = st.text_input("Your Local Area", placeholder="Enter the area you serve (e.g., Southwest Garden, St. Louis)")holiday_theme = st.text_input("Holiday Theme", placeholder="Enter a specific holiday theme or message (e.g., community spirit, gratitude, holiday events)")call_to_action = st.text_input("Call to Action", placeholder="Enter your desired call to action (e.g., visit your website, schedule a consultation)")initial_messages = [{"role": "system","content": """Act as a real estate marketing video script writer specialized in holiday-themed scripts. Respond withfully written video scripts that contain only the words to be read out loud into the camera by a real estate agent.These scripts should not include shot directions, references to who is speaking, or any other extraneous notes.Create distinctive, succinct, and compelling scripts ideal for short social media videos. Start with engaging opening lines,avoid generic greetings, and conclude with a strong call to action based on the agent's input. Base the script on the specificholiday theme or topic provided by the agent."""}]if st.button('Generate Script'):# Process the inputs and call the OpenAI APIuser_input = f"Create a holiday video script for a real estate agent named {agent_name}, serving the {local_area} area. The holiday theme is '{holiday_theme}'. The script should end with a call to action: '{call_to_action}'."# Call the OpenAI API with the chat modelresponse = openai.ChatCompletion.create(model="gpt-4", # Replace with the GPT-4 model you are usingmessages=[{"role": "system", "content": initial_messages[0]["content"]},{"role": "user", "content": user_input}])# Display the response from the APIst.write(response.choices[0].message['content'])123456789101112131415161718192021222324252627import streamlit as stimport openai# Access the OpenAI API keyopenai.api_key = st.secrets["YOUR_OPENAI_API_KEY"]st.title("Real Estate Video Background Image Generator")# User inputs for image generationimage_theme = st.text_input("Image Theme", placeholder="Enter a theme for your image (e.g., cozy living room, modern office)")color_scheme = st.text_input("Color Scheme", placeholder="Preferred color scheme (e.g., warm, cool, monochromatic)")additional_elements = st.text_input("Additional Elements", placeholder="Any specific elements to include in the image?")if st.button('Generate Image'):# Construct the promptprompt = f"Create an image with the theme: '{image_theme}', color scheme: '{color_scheme}', including elements: '{additional_elements}'."# Call the DALL-E APIresponse = openai.Image.create(prompt=prompt,n=1, # Number of images to generatesize="1024x1024" # Image dimensions)# Display the imageimage_data = response.data[0] # Assuming response contains image datast.image(image_data, caption='Generated Image')
app.py+17-29