import streamlit as st
import pandas as pd
from llm_services.agenthub import recommend_talent_agent
from llm_services.tools import recommend_talent_tool
st.set_page_config(
page_title="Talent Recommender",
page_icon="🎯",
layout="wide"
)
st.markdown("""
""", unsafe_allow_html=True)
st.markdown("""
""", unsafe_allow_html=True)
if 'search_history' not in st.session_state:
st.session_state.search_history = []
st.markdown("### What kind of talent are you looking for?")
brand_request = st.text_area(
"Describe your needs in natural language",
placeholder="e.g., We need financial advisors with high engagement to promote our investment app to professionals aged 30-50",
height=120
)
search_button = st.button("Find Talent", type="primary")
if search_button and brand_request:
if brand_request not in st.session_state.search_history:
st.session_state.search_history.append(brand_request)
with st.spinner("Finding the perfect talent matches..."):
try:
search_args = recommend_talent_agent(brand_request=brand_request)
with st.expander("Search Parameters", expanded=False):
st.json(search_args)
profiles = recommend_talent_tool(**search_args)
st.subheader(f"Top 10 K Results")
tab1, tab2 = st.tabs(["Cards View", "Table View"])
with tab1:
for i, profile in enumerate(profiles):
with st.container():
st.markdown(f"""
{profile['name']}
Age: {profile['age']} | Gender: {profile['gender']}
Verticals: {', '.join(profile['verticals'])}
Bio: {profile['bio']}
{profile['follower_count']:,}
Followers
{profile['overall_engagement']:.1%}
Engagement
""", unsafe_allow_html=True)
with tab2:
table_data = []
for profile in profiles:
table_data.append({
"Name": profile['name'],
"Age": profile['age'],
"Gender": profile['gender'],
"Verticals": ", ".join(profile['verticals']),
"Followers": profile['follower_count'],
"Engagement": f"{profile['overall_engagement']:.1%}"
})
df = pd.DataFrame(table_data)
st.dataframe(
df,
use_container_width=True,
hide_index=True
)
except Exception as e:
st.error(f"An error occurred: {str(e)}")
st.info("Please try refining your request or check your connection.")
else:
if st.session_state.search_history:
st.markdown("### Recent Searches")
for idx, search in enumerate(st.session_state.search_history[-3:]):
if st.button(f"{search}", key=f"history_{idx}"):
brand_request = search
st.experimental_rerun()
st.markdown("""
### How to use this tool:
Simply describe what kind of talent you're looking for in natural language. Our AI will analyze your request and find the most suitable matches from our database.
**Example:** "We need financial advisors with high engagement rates to promote our new investment app targeting professionals aged 35-55."
""")
st.markdown("---")
st.markdown("""
Talent Recommender v1.0 | Powered by AI | © 2025
""", unsafe_allow_html=True)