InstaImpact / app.py
gkdivya's picture
Update app.py
b1221c9
import streamlit as st
import influencer_ui
import influencer_onboarding
import base64
def get_base64_of_bin_file(bin_file):
"""
Converts a binary file to base64 encoding.
"""
with open(bin_file, 'rb') as file:
data = file.read()
return base64.b64encode(data).decode()
def set_bg_from_local_image(local_img_path):
"""
Sets a local image as the background of the Streamlit app.
"""
bin_str = get_base64_of_bin_file(local_img_path)
page_bg_img = f"""
<style>
.stApp {{
background-image: url("data:image/png;base64,{bin_str}");
background-size: cover;
background-attachment: fixed;
background-repeat: no-repeat;
background-position: center center;
}}
.stApp:before {{
content: '';
display: block;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(255, 255, 255, 0.2); /* Adjust the color and opacity here */
z-index: -1;
}}
</style>
"""
st.markdown(page_bg_img, unsafe_allow_html=True)
def main():
# Page Configuration
st.set_page_config(page_title="InstaImpact", layout="wide")
set_bg_from_local_image('images/influencer_edited.png')
# Sidebar for Navigation
st.sidebar.title("Navigation")
st.sidebar.markdown("Select the feature you want to explore:")
# Define navigation options with a flag to indicate if they are enabled or disabled
nav_options = ["Homepage", "Influencer Search", "Onboard Influencers", "Campaign Analytics", "Market Trends"]
selection = st.sidebar.radio("Go to", nav_options)
# Homepage
if selection == "Homepage":
st.markdown("<h1 style='text-align: center; color: white;'>Welcome to InstaImpact</h1>", unsafe_allow_html=True)
st.markdown("""
<div style="font-size: 20px; color: white;">
<p><strong>InstaImpact is your comprehensive tool for influencer marketing.</strong></p>
<ul>
<li>Discover and analyze influencers</li>
<li>Plan and manage your campaigns</li>
<li>Get insights on the latest market trends</li>
</ul>
</div>
""", unsafe_allow_html=True)
st.markdown("<h2 style='color: white;'>Platform Capabilities</h2>", unsafe_allow_html=True)
st.markdown("""
<div style="font-size: 18px; color: white;">
<ul>
<li><strong>Influencer Search</strong>: Find the perfect influencer match for your brand.</li>
<li><strong>Campaign Analytics</strong>: Measure the success of your campaigns.</li>
<li><strong>Market Trends</strong>: Stay ahead with the latest in influencer marketing.</li>
</ul>
</div>
""", unsafe_allow_html=True)
# Influencer Search
elif selection == "Influencer Search":
influencer_ui.show_influencer_search_page()
# Add a navigation option for Onboarding
elif selection == "Onboard Influencers":
influencer_onboarding.show_onboarding_page()
elif selection == "Campaign Analytics":
st.header("Campaign Analytics")
st.write("View and analyze your campaign performance - Coming Soon")
elif selection == "Market Trends":
st.header("Market Trends")
st.write("Explore the latest trends in influencer marketing - Coming Soon")
main()