Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,6 +11,15 @@ load_dotenv()
|
|
| 11 |
genai.configure(api_key=os.getenv('GOOGLE_API_KEY'))
|
| 12 |
model = genai.GenerativeModel('gemini-pro')
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Custom CSS
|
| 15 |
st.markdown(get_custom_css(), unsafe_allow_html=True)
|
| 16 |
|
|
@@ -18,41 +27,48 @@ st.markdown(get_custom_css(), unsafe_allow_html=True)
|
|
| 18 |
st.title('🚀 Great Offer Generator')
|
| 19 |
st.markdown('''### Transform your skills into compelling offers!''')
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
Skills
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
# Footer
|
| 57 |
st.markdown('---')
|
| 58 |
-
st.markdown('Made with ❤️
|
|
|
|
| 11 |
genai.configure(api_key=os.getenv('GOOGLE_API_KEY'))
|
| 12 |
model = genai.GenerativeModel('gemini-pro')
|
| 13 |
|
| 14 |
+
# Hide Streamlit menu and footer
|
| 15 |
+
st.markdown("""
|
| 16 |
+
<style>
|
| 17 |
+
#MainMenu {visibility: hidden;}
|
| 18 |
+
footer {visibility: hidden;}
|
| 19 |
+
header {visibility: hidden;}
|
| 20 |
+
</style>
|
| 21 |
+
""", unsafe_allow_html=True)
|
| 22 |
+
|
| 23 |
# Custom CSS
|
| 24 |
st.markdown(get_custom_css(), unsafe_allow_html=True)
|
| 25 |
|
|
|
|
| 27 |
st.title('🚀 Great Offer Generator')
|
| 28 |
st.markdown('''### Transform your skills into compelling offers!''')
|
| 29 |
|
| 30 |
+
# Create two columns for layout
|
| 31 |
+
col1, col2 = st.columns([1, 1])
|
| 32 |
+
|
| 33 |
+
# Main input section in left column
|
| 34 |
+
with col1:
|
| 35 |
+
skills = st.text_area('💪 Your Skills', height=70,
|
| 36 |
+
help='List your key skills and expertise')
|
| 37 |
+
product_service = st.text_area('🎯 Product/Service', height=70,
|
| 38 |
+
help='Describe your product or service')
|
| 39 |
+
|
| 40 |
+
# Accordion for additional settings
|
| 41 |
+
with st.expander('⚙️ Advanced Settings'):
|
| 42 |
+
target_audience = st.text_area('👥 Target Audience', height=70,
|
| 43 |
+
help='Describe your ideal customer or client')
|
| 44 |
+
temperature = st.slider('🌡️ Creativity Level', min_value=0.0, max_value=2.0, value=0.7,
|
| 45 |
+
help='Higher values make the output more creative but less focused')
|
| 46 |
+
|
| 47 |
+
# Generate button
|
| 48 |
+
if st.button('Generate Offer 🎉'):
|
| 49 |
+
if not skills or not product_service:
|
| 50 |
+
st.error('Please fill in both Skills and Product/Service fields')
|
| 51 |
+
else:
|
| 52 |
+
with st.spinner('Creating your perfect offer...'):
|
| 53 |
+
prompt = f"""Based on the following information, create a compelling offer:
|
| 54 |
+
Skills: {skills}
|
| 55 |
+
Product/Service: {product_service}
|
| 56 |
+
Target Audience: {target_audience if target_audience else 'General audience'}
|
| 57 |
+
|
| 58 |
+
Please create a professional and engaging offer that highlights the value proposition
|
| 59 |
+
and appeals to the target audience. Include a clear call to action."""
|
| 60 |
+
|
| 61 |
+
try:
|
| 62 |
+
response = model.generate_content(prompt, temperature=temperature)
|
| 63 |
+
st.success('✨ Your offer is ready!')
|
| 64 |
+
|
| 65 |
+
# Display result in the right column
|
| 66 |
+
with col2:
|
| 67 |
+
st.markdown('### 📝 Generated Offer')
|
| 68 |
+
st.markdown(response.text)
|
| 69 |
+
except Exception as e:
|
| 70 |
+
st.error(f'An error occurred: {str(e)}')
|
| 71 |
|
| 72 |
# Footer
|
| 73 |
st.markdown('---')
|
| 74 |
+
st.markdown('Made with ❤️ by Jesús Cabrera')
|