Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import requests | |
| influencers_data = { | |
| "influencer1": { | |
| "onboarded": True, | |
| "name": "Influencer One", | |
| "image": "./images/inf1.png", # Replace with actual image paths | |
| "details": "Details about Influencer One..." | |
| }, | |
| "influencer2": { | |
| "onboarded": True, | |
| "name": "Influencer Two", | |
| "image": "./images/inf2.png", | |
| "details": "Details about Influencer Two..." | |
| }, | |
| "influencer3": { | |
| "onboarded": False, | |
| "name": "Influencer Two", | |
| "image": "./images/inf2.png" | |
| } | |
| # Add more influencers as needed | |
| } | |
| def onboard_single_influencer(handle): | |
| url = "https://us-central1-steam-cache-277314.cloudfunctions.net/create_insta_task" | |
| data = {"handle": handle} | |
| response = requests.post(url, json=data) | |
| st.write(response) | |
| if response.status_code == 200: | |
| st.write("Onboarding influencer! Please wait...") | |
| else: | |
| st.write(response["data"]["error"]) | |
| def show_onboarding_page(): | |
| st.title("Onboard Influencers") | |
| # Upload field for multiple influencers | |
| uploaded_file = st.file_uploader("Upload a file with influencer handles", type=["csv", "xlsx"]) | |
| # Input for single influencer handle | |
| single_handle = st.text_input("...or enter a single influencer handle") | |
| # Onboard button | |
| if st.button("Onboard Influencers"): | |
| if uploaded_file is not None: | |
| # Process the uploaded file | |
| onboard_influencers_from_file(uploaded_file) | |
| elif single_handle: | |
| # Process the single handle | |
| onboard_single_influencer(single_handle) | |
| else: | |
| st.error("Please upload a file or enter a handle.") | |
| # Function to display onboarded influencers (placeholder) | |
| display_onboarded_influencers() | |
| def onboard_influencers_from_file(file): | |
| # Logic to read and process file to onboard influencers | |
| pass # Replace with actual implementation | |
| def display_onboarded_influencers(): | |
| # Display the list of onboarded influencers | |
| st.write("List of Onboarded Influencers...") | |
| for influencer_id, influencer_info in influencers_data.items(): | |
| col1, col2 = st.columns([1, 3]) | |
| with col1: | |
| st.image(influencer_info["image"], width=30) | |
| with col2: | |
| if(influencer_info["onboarded"]): | |
| with st.expander("Influencer Details"): | |
| st.subheader(influencer_info["name"]) | |
| st.write(influencer_info["details"]) | |
| else: | |
| with st.expander("Influencer Onboarding - In Progress"): | |
| st.write("Onboarding - In Progress") | |