JeCabrera commited on
Commit
2f69897
Β·
verified Β·
1 Parent(s): 83207d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -35
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
- # Main input section
22
- skills = st.text_area('πŸ’ͺ Your Skills', height=100,
23
- help='List your key skills and expertise')
24
- product_service = st.text_area('🎯 Product/Service', height=100,
25
- help='Describe your product or service')
26
-
27
- # Accordion for additional settings
28
- with st.expander('βš™οΈ Advanced Settings'):
29
- target_audience = st.text_area('πŸ‘₯ Target Audience', height=100,
30
- help='Describe your ideal customer or client')
31
- temperature = st.slider('🌑️ Creativity Level', min_value=0.0, max_value=1.0, value=0.7,
32
- help='Higher values make the output more creative but less focused')
33
-
34
- # Generate button
35
- if st.button('Generate Offer πŸŽ‰'):
36
- if not skills or not product_service:
37
- st.error('Please fill in both Skills and Product/Service fields')
38
- else:
39
- with st.spinner('Creating your perfect offer...'):
40
- prompt = f"""Based on the following information, create a compelling offer:
41
- Skills: {skills}
42
- Product/Service: {product_service}
43
- Target Audience: {target_audience if target_audience else 'General audience'}
44
-
45
- Please create a professional and engaging offer that highlights the value proposition
46
- and appeals to the target audience. Include a clear call to action."""
47
-
48
- try:
49
- response = model.generate_content(prompt, temperature=temperature)
50
- st.success('✨ Your offer is ready!')
51
- st.markdown('### πŸ“ Generated Offer')
52
- st.markdown(response.text)
53
- except Exception as e:
54
- st.error(f'An error occurred: {str(e)}')
 
 
 
 
 
 
 
55
 
56
  # Footer
57
  st.markdown('---')
58
- st.markdown('Made with ❀️ using Streamlit and Google Gemini AI')
 
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')