Spaces:
Sleeping
Sleeping
File size: 2,357 Bytes
3fe53b9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
import streamlit as st
import google.generativeai as genai
import os
from dotenv import load_dotenv
from styles import get_custom_css
# Load environment variables
load_dotenv()
# Configure Google Gemini API
genai.configure(api_key=os.getenv('GOOGLE_API_KEY'))
model = genai.GenerativeModel('gemini-pro')
# Custom CSS
st.markdown(get_custom_css(), unsafe_allow_html=True)
# App title and description
st.title('π Great Offer Generator')
st.markdown('''### Transform your skills into compelling offers!''')
# Main input section
skills = st.text_area('πͺ Your Skills', height=100,
help='List your key skills and expertise')
product_service = st.text_area('π― Product/Service', height=100,
help='Describe your product or service')
# Accordion for additional settings
with st.expander('βοΈ Advanced Settings'):
target_audience = st.text_area('π₯ Target Audience', height=100,
help='Describe your ideal customer or client')
temperature = st.slider('π‘οΈ Creativity Level', min_value=0.0, max_value=1.0, value=0.7,
help='Higher values make the output more creative but less focused')
# Generate button
if st.button('Generate Offer π'):
if not skills or not product_service:
st.error('Please fill in both Skills and Product/Service fields')
else:
with st.spinner('Creating your perfect offer...'):
prompt = f"""Based on the following information, create a compelling offer:
Skills: {skills}
Product/Service: {product_service}
Target Audience: {target_audience if target_audience else 'General audience'}
Please create a professional and engaging offer that highlights the value proposition
and appeals to the target audience. Include a clear call to action."""
try:
response = model.generate_content(prompt, temperature=temperature)
st.success('β¨ Your offer is ready!')
st.markdown('### π Generated Offer')
st.markdown(response.text)
except Exception as e:
st.error(f'An error occurred: {str(e)}')
# Footer
st.markdown('---')
st.markdown('Made with β€οΈ using Streamlit and Google Gemini AI') |