Spaces:
Sleeping
Sleeping
Update influencer_ui.py
Browse files- influencer_ui.py +18 -36
influencer_ui.py
CHANGED
|
@@ -18,60 +18,42 @@ influencers_data = {
|
|
| 18 |
}
|
| 19 |
|
| 20 |
# Function to display influencer details
|
| 21 |
-
|
| 22 |
-
st.subheader(influencer_info["name"])
|
| 23 |
-
st.image(influencer_info["image"], width=200)
|
| 24 |
-
st.write(influencer_info["details"])
|
| 25 |
|
| 26 |
|
| 27 |
def show_influencer_search_page():
|
| 28 |
st.header("Influencer Search and Analysis")
|
| 29 |
st.markdown("Discover influencers by name, niche, location, follower count, and more.")
|
| 30 |
search_query = st.text_input("Search Influencers", "")
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
if 'selected_influencer' not in st.session_state:
|
| 34 |
st.session_state.selected_influencer = None
|
| 35 |
|
| 36 |
-
#
|
| 37 |
-
st.
|
| 38 |
-
col1, col2, col3 = st.columns(3)
|
| 39 |
-
with col1:
|
| 40 |
-
niche = st.selectbox("Niche", ["Fashion", "Beauty", "Lifestyle"])
|
| 41 |
-
with col2:
|
| 42 |
-
location = st.selectbox("Location", ["Global", "North America", "Europe", "Asia"])
|
| 43 |
-
with col3:
|
| 44 |
-
follower_count = st.slider("Follower Count Range", 1000, 1000000, (10000, 500000))
|
| 45 |
|
| 46 |
-
# Displaying Search Results (placeholder content)
|
| 47 |
-
st.markdown("### Search Results")
|
| 48 |
-
if search_query:
|
| 49 |
-
st.write(f"Showing results for: {search_query}")
|
| 50 |
-
# Placeholder for search results
|
| 51 |
-
st.write("Influencer 1 - Profile Overview...")
|
| 52 |
-
st.write("Influencer 2 - Profile Overview...")
|
| 53 |
-
else:
|
| 54 |
-
search_concept = st.text_input("Enter a search term to see results:", "")
|
| 55 |
-
search_button = st.button("Search")
|
| 56 |
-
|
| 57 |
if search_button:
|
| 58 |
# Display influencer images as clickable buttons
|
| 59 |
for influencer_id, influencer_info in influencers_data.items():
|
| 60 |
col1, col2 = st.columns([1, 3])
|
| 61 |
-
|
| 62 |
with col1:
|
| 63 |
-
# Display the influencer image
|
| 64 |
st.image(influencer_info["image"], width=50)
|
| 65 |
-
|
|
|
|
| 66 |
if st.button(influencer_info["name"], key=influencer_id):
|
| 67 |
st.session_state.selected_influencer = influencer_id
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
st.subheader(selected_influencer_info["name"])
|
| 74 |
-
st.image(selected_influencer_info["image"], width=200)
|
| 75 |
-
st.write(selected_influencer_info["details"])
|
| 76 |
|
| 77 |
|
|
|
|
| 18 |
}
|
| 19 |
|
| 20 |
# Function to display influencer details
|
| 21 |
+
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
|
| 24 |
def show_influencer_search_page():
|
| 25 |
st.header("Influencer Search and Analysis")
|
| 26 |
st.markdown("Discover influencers by name, niche, location, follower count, and more.")
|
| 27 |
search_query = st.text_input("Search Influencers", "")
|
| 28 |
+
|
| 29 |
+
def display_influencer_details(influencer_info):
|
| 30 |
+
with st.container(): # Using a container to organize the layout
|
| 31 |
+
st.subheader(influencer_info["name"])
|
| 32 |
+
st.image(influencer_info["image"], width=200)
|
| 33 |
+
st.write(influencer_info["details"])
|
| 34 |
+
|
| 35 |
+
# Initialize session state for selected influencer
|
| 36 |
if 'selected_influencer' not in st.session_state:
|
| 37 |
st.session_state.selected_influencer = None
|
| 38 |
|
| 39 |
+
# Influencer search button (assuming this is part of your UI)
|
| 40 |
+
search_button = st.button("Search Influencers")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
if search_button:
|
| 43 |
# Display influencer images as clickable buttons
|
| 44 |
for influencer_id, influencer_info in influencers_data.items():
|
| 45 |
col1, col2 = st.columns([1, 3])
|
| 46 |
+
|
| 47 |
with col1:
|
|
|
|
| 48 |
st.image(influencer_info["image"], width=50)
|
| 49 |
+
|
| 50 |
+
with col2:
|
| 51 |
if st.button(influencer_info["name"], key=influencer_id):
|
| 52 |
st.session_state.selected_influencer = influencer_id
|
| 53 |
|
| 54 |
+
# Display the details of the selected influencer outside the loop
|
| 55 |
+
if st.session_state.selected_influencer:
|
| 56 |
+
selected_influencer_info = influencers_data[st.session_state.selected_influencer]
|
| 57 |
+
display_influencer_details(selected_influencer_info)
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
|