muqeet1234 commited on
Commit
e58ec1a
·
verified ·
1 Parent(s): 8489ba4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +75 -0
app.py CHANGED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import numpy as np
4
+
5
+ # Streamlit UI for the Amazon PPC Keyword Optimizer
6
+ st.title("Amazon PPC Keyword Optimizer")
7
+ st.write("Suggest optimal keywords for Amazon PPC campaigns based on product details and target audience.")
8
+
9
+ # Input fields for product details
10
+ st.header("Product Details")
11
+ product_name = st.text_input("Enter product name")
12
+ product_category = st.selectbox("Select product category", ["Electronics", "Clothing", "Home", "Beauty", "Toys"])
13
+ product_features = st.text_area("Enter key product features (e.g., color, size, functionality)")
14
+
15
+ # Input fields for target audience
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
+ )