InstaImpact / influencer_ui.py
Janmejaya's picture
Update influencer_ui.py
6a47459
raw
history blame
2.06 kB
import streamlit as st
from PIL import Image
import requests
from io import BytesIO
import json
profile_default_image_url = "https://t4.ftcdn.net/jpg/03/46/93/61/360_F_346936114_RaxE6OQogebgAWTalE1myseY1Hbb5qPM.jpg"
insta_rag_url = "https://us-central1-steam-cache-277314.cloudfunctions.net/gemini-hackathon-insta-influencer"
# 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
# }
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", "")
# Influencer search button (assuming this is part of your UI)
search_button = st.button("Search Influencers")
if search_button:
data = {"search_query": search_query}
resp = requests.post(insta_rag_url, json=data)
response_dict = json.loads(resp.text)
influencers_data = {response_dict.get('handle', "No Name"): {"name": response_dict.get('name', 'No Name'),
"image": response_dict.get('profile_image_url', profile_default_image_url),
"details": response_dict.get('bio', '')}}
# Display influencer images as clickable buttons
for influencer_id, influencer_info in influencers_data.items():
col1, col2 = st.columns([1, 3])
with col1:
st.image(influencer_info["image"], width=50)
with col2:
with st.expander("Influencer Details"):
st.subheader(influencer_info["name"])
st.write(influencer_info["details"])