InstaImpact / influencer_ui.py
gkdivya's picture
Update influencer_ui.py
a45f089
raw
history blame
2.86 kB
import streamlit as st
from PIL import Image
import requests
from io import BytesIO
influencers_data = {
"influencer1": {
"name": "Influencer One",
"image": "./images/inf1.png", # Replace with actual image paths
"details": "Details about Influencer One..."
},
"influencer2": {
"name": "Influencer Two",
"image": "./images/inf2.png",
"details": "Details about Influencer Two..."
}
# Add more influencers as needed
}
# Function to display influencer details
def display_influencer_details(influencer_info):
st.subheader(influencer_info["name"])
st.image(influencer_info["image"], width=200)
st.write(influencer_info["details"])
def show_influencer_search_page():
st.header("Influencer Search and Analysis")
st.markdown("Discover influencers by name, niche, location, follower count, and more.")
search_query = st.text_input("Search Influencers", "")
# Session state to keep track of which influencer's details to display
if 'selected_influencer' not in st.session_state:
st.session_state.selected_influencer = None
# Advanced Filters (placeholder functionality)
st.markdown("### Advanced Filters")
col1, col2, col3 = st.columns(3)
with col1:
niche = st.selectbox("Niche", ["Fashion", "Beauty", "Lifestyle"])
with col2:
location = st.selectbox("Location", ["Global", "North America", "Europe", "Asia"])
with col3:
follower_count = st.slider("Follower Count Range", 1000, 1000000, (10000, 500000))
# Displaying Search Results (placeholder content)
st.markdown("### Search Results")
if search_query:
st.write(f"Showing results for: {search_query}")
# Placeholder for search results
st.write("Influencer 1 - Profile Overview...")
st.write("Influencer 2 - Profile Overview...")
else:
search_concept = st.text_input("Enter a search term to see results:", "")
search_button = st.button("Search")
if search_button:
# Display influencer images as clickable buttons
for influencer_id, influencer_info in influencers_data.items():
col1, col2 = st.columns([1, 3])
with col1:
# Display the influencer image
st.image(influencer_info["image"], width=100)
with col2:
# Create a button with the influencer's name
# Button to select an influencer
if st.button(influencer_info["name"], key=influencer_id):
st.session_state.selected_influencer = influencer_id
# Display the details of the selected influencer
if st.session_state.selected_influencer:
display_influencer_details(influencers_data[st.session_state.selected_influencer])