JaveriaZia commited on
Commit
15d4a5b
Β·
verified Β·
1 Parent(s): d39ac5a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +59 -13
app.py CHANGED
@@ -1,13 +1,34 @@
1
  import streamlit as st
 
 
2
 
3
- def generate_response(name, concern):
4
- return f"""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  <h4 style='color:red;'>🌟 Greeting</h4>
6
  <div style='color:black;'>Hey {name}! πŸ‘‹</div>
7
 
8
  <h4 style='color:red;'>🩺 Skin Issue Summary</h4>
9
  <div style='color:black;'>
10
- Skin Issue Summary: {concern} have appeared on your skin, affecting your confidence. It's essential to address this concern to even out your skin tone.
11
  </div>
12
 
13
  <h4 style='color:red;'>πŸ“Š Global Insight</h4>
@@ -43,17 +64,42 @@ def generate_response(name, concern):
43
  <div style='color:black;'>β€œDo something today that your future self will thank you for.”</div>
44
  """
45
 
46
- # Streamlit UI
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  st.set_page_config(page_title="SkinSense AI", layout="centered")
48
 
49
- st.title("🧴 SkinSense AI - Personalized Skincare Assistant")
 
 
 
 
 
 
50
 
51
  with st.form("skincare_form"):
52
- name = st.text_input("Your Name", placeholder="e.g., Javeria")
53
- concern = st.text_area("Describe Your Skin Concern", placeholder="e.g., I have dark spots on my cheeks")
54
- submit = st.form_submit_button("Get My Skincare Plan")
55
-
56
- if submit and name and concern:
57
- st.markdown("---")
58
- st.subheader("🧾 Your Personalized Skin Guide")
59
- st.markdown(generate_response(name, concern), unsafe_allow_html=True)
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ import os, random
3
+ from groq import Groq
4
 
5
+ # βœ… Initialize Groq client
6
+ client = Groq(api_key=os.getenv("GROQ_API_KEY"))
7
+
8
+ # βœ… Cute skincare stickers
9
+ stickers = [
10
+ "https://media.giphy.com/media/3o6Zt481isNVuQI1l6/giphy.gif",
11
+ "https://media.giphy.com/media/l3q2XB76CaWPggiNW/giphy.gif",
12
+ "https://media.giphy.com/media/26tPplGWjN0xLybiU/giphy.gif",
13
+ "https://media.giphy.com/media/3o7TKP9XDb9IzUrJXa/giphy.gif",
14
+ "https://media.giphy.com/media/26Fxy3Iz1ari8oytO/giphy.gif",
15
+ ]
16
+
17
+ # βœ… Hardcoded formatted output for demo
18
+ def skincare_advice(name, gender, age, skin_concern, description, image, duration, sensitivity, routine):
19
+ if not name.strip():
20
+ return "⚠ Please enter your name."
21
+
22
+ sticker = random.choice(stickers)
23
+
24
+ # βœ… Replace 'Javeria' with actual name in template
25
+ formatted_output = f"""
26
  <h4 style='color:red;'>🌟 Greeting</h4>
27
  <div style='color:black;'>Hey {name}! πŸ‘‹</div>
28
 
29
  <h4 style='color:red;'>🩺 Skin Issue Summary</h4>
30
  <div style='color:black;'>
31
+ Skin Issue Summary: Dark spots have appeared on your skin, affecting your confidence. It's essential to address this concern to even out your skin tone.
32
  </div>
33
 
34
  <h4 style='color:red;'>πŸ“Š Global Insight</h4>
 
64
  <div style='color:black;'>β€œDo something today that your future self will thank you for.”</div>
65
  """
66
 
67
+ return f"""
68
+ <div style='font-family:Arial, sans-serif; color:#111; background:#fff; padding:20px;
69
+ border-radius:15px; border:2px solid #000; box-shadow:0px 3px 10px rgba(0,0,0,0.3);'>
70
+ <div style='display:flex; align-items:center; justify-content:space-between;'>
71
+ <h2 style='color:#000; margin:0;'>πŸ‘€ <b>{name}</b> | {gender}, {age} yrs</h2>
72
+ <img src="{sticker}" style="width:70px; border-radius:10px;">
73
+ </div>
74
+ <div style='margin-top:15px; font-size:16px; line-height:1.7;'>
75
+ {formatted_output}
76
+ </div>
77
+ </div>
78
+ """
79
+
80
+ # βœ… Streamlit UI
81
  st.set_page_config(page_title="SkinSense AI", layout="centered")
82
 
83
+ st.markdown("""
84
+ <h1 style='text-align:center; font-family:Arial; font-size:30px;
85
+ background: linear-gradient(to right, black, #4CAF50);
86
+ -webkit-background-clip: text; color: transparent;'>
87
+ 🌿 <b>Welcome to SkinSense AI – Your Smart Skincare Buddy</b>
88
+ </h1>
89
+ """, unsafe_allow_html=True)
90
 
91
  with st.form("skincare_form"):
92
+ name = st.text_input("πŸ“ Name")
93
+ gender = st.selectbox("🚻 Gender", ["Female", "Male", "Other"])
94
+ age = st.slider("πŸŽ‚ Age", 5, 100, 25)
95
+ skin_concern = st.selectbox("🌟 Select a Common Skin Concern", ["Dark Spots", "Acne", "Tanned Skin", "Oily Skin", "Dryness", "Other"])
96
+ description = st.text_area("🧾 Or Describe Your Skin Concern")
97
+ image = st.file_uploader("πŸ“· Upload Image (optional)")
98
+ duration = st.selectbox("⏳ How long?", ["πŸ†• Less than a week", "πŸ“† 1–4 weeks", "πŸ“… Over a month"])
99
+ sensitivity = st.selectbox("πŸ§ͺ Sensitive Skin?", ["Yes", "No", "Not Sure"])
100
+ routine = st.selectbox("🧴 Skincare Routine?", ["Yes", "No"])
101
+ submit = st.form_submit_button("✨ Get My Personalized Advice")
102
+
103
+ if submit:
104
+ output = skincare_advice(name, gender, age, skin_concern, description, image, duration, sensitivity, routine)
105
+ st.markdown(output, unsafe_allow_html=True)