Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,75 +1,38 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
import pandas as pd
|
| 3 |
-
import numpy as np
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
st.
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
st.
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
st.header("Target Audience")
|
| 17 |
-
audience_gender = st.selectbox("Select audience gender", ["Male", "Female", "Unisex"])
|
| 18 |
-
audience_age = st.slider("Select audience age range", min_value=18, max_value=65, value=(25, 45))
|
| 19 |
-
audience_location = st.text_input("Enter target location (e.g., USA, UK)")
|
| 20 |
-
|
| 21 |
-
# Input fields for existing product keywords
|
| 22 |
-
st.header("Existing Product Keywords")
|
| 23 |
-
keywords_input = st.text_area("Enter current product keywords (comma-separated)")
|
| 24 |
-
|
| 25 |
-
# Generate recommended keywords based on input
|
| 26 |
-
def generate_keywords(product_category, product_features, audience_gender, audience_age, audience_location, keywords_input):
|
| 27 |
-
# Sample logic to generate recommended keywords (can be expanded with a more advanced model)
|
| 28 |
-
|
| 29 |
-
keywords = set(keywords_input.split(","))
|
| 30 |
-
|
| 31 |
-
# Add product-specific features
|
| 32 |
-
features_keywords = product_features.split(",")
|
| 33 |
-
for feature in features_keywords:
|
| 34 |
-
keywords.add(feature.strip())
|
| 35 |
-
|
| 36 |
-
# Add category-related keywords
|
| 37 |
-
category_keywords = {
|
| 38 |
-
"Electronics": ["gadgets", "tech", "smartphone", "device", "electronics"],
|
| 39 |
-
"Clothing": ["fashion", "apparel", "clothing", "t-shirt", "jeans"],
|
| 40 |
-
"Home": ["home", "furniture", "decor", "household"],
|
| 41 |
-
"Beauty": ["beauty", "skincare", "cosmetics", "makeup"],
|
| 42 |
-
"Toys": ["toys", "kids", "play", "educational", "fun"]
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
for keyword in category_keywords.get(product_category, []):
|
| 46 |
-
keywords.add(keyword)
|
| 47 |
-
|
| 48 |
-
# Add audience-related keywords
|
| 49 |
-
if audience_gender:
|
| 50 |
-
keywords.add(audience_gender.lower())
|
| 51 |
-
if audience_location:
|
| 52 |
-
keywords.add(audience_location.lower())
|
| 53 |
-
keywords.add(f"age{audience_age[0]}-{audience_age[1]}")
|
| 54 |
-
|
| 55 |
-
return list(keywords)
|
| 56 |
-
|
| 57 |
-
# Button to generate recommended keywords
|
| 58 |
-
if st.button("Generate Recommended Keywords"):
|
| 59 |
-
# Generate keywords based on user input
|
| 60 |
-
recommended_keywords = generate_keywords(product_category, product_features, audience_gender, audience_age, audience_location, keywords_input)
|
| 61 |
-
|
| 62 |
-
# Display the recommended keywords
|
| 63 |
-
st.write("### Recommended Keywords")
|
| 64 |
-
st.write(", ".join(recommended_keywords))
|
| 65 |
-
|
| 66 |
-
# Prepare DataFrame for CSV export
|
| 67 |
-
df_keywords = pd.DataFrame(recommended_keywords, columns=["Recommended Keywords"])
|
| 68 |
-
|
| 69 |
-
# Button to download the CSV file
|
| 70 |
-
st.download_button(
|
| 71 |
-
label="Download Recommended Keywords as CSV",
|
| 72 |
-
data=df_keywords.to_csv(index=False),
|
| 73 |
-
file_name="recommended_keywords.csv",
|
| 74 |
-
mime="text/csv"
|
| 75 |
-
)
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
|
|
|
| 2 |
|
| 3 |
+
# Set the background image using custom CSS
|
| 4 |
+
st.markdown(
|
| 5 |
+
"""
|
| 6 |
+
<style>
|
| 7 |
+
body {
|
| 8 |
+
background-image: url('https://example.com/background-image.jpg'); /* Change the URL to your image URL */
|
| 9 |
+
background-size: cover;
|
| 10 |
+
background-position: center;
|
| 11 |
+
color: white;
|
| 12 |
+
}
|
| 13 |
+
.sidebar .sidebar-content {
|
| 14 |
+
background-color: rgba(255, 255, 255, 0.8); /* Add transparency for the sidebar */
|
| 15 |
+
padding: 15px;
|
| 16 |
+
}
|
| 17 |
+
</style>
|
| 18 |
+
""",
|
| 19 |
+
unsafe_allow_html=True,
|
| 20 |
+
)
|
| 21 |
|
| 22 |
+
# Sidebar content: Beautiful description about nail care
|
| 23 |
+
st.sidebar.title("Health Nail Care")
|
| 24 |
+
st.sidebar.write("""
|
| 25 |
+
Nail care is essential for maintaining healthy, strong, and beautiful nails. Proper nail care involves regular cleaning,
|
| 26 |
+
trimming, and moisturizing. Nails should be protected from harmful chemicals and physical trauma. Eating a balanced diet
|
| 27 |
+
rich in vitamins, minerals, and protein is crucial for optimal nail health. Regularly checking for nail infections or
|
| 28 |
+
abnormalities can help in early detection and treatment.
|
| 29 |
+
|
| 30 |
+
Here are some tips for healthy nails:
|
| 31 |
+
- Keep nails clean and trimmed.
|
| 32 |
+
- Use a moisturizing lotion or oil for your nails.
|
| 33 |
+
- Avoid biting nails and using them as tools.
|
| 34 |
+
- Apply a base coat before using nail polish to prevent staining.
|
| 35 |
+
- Make sure to stay hydrated and eat a balanced diet rich in biotin, zinc, and iron.
|
| 36 |
+
""")
|
| 37 |
|
| 38 |
+
# Main con
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|