TalentIQ-AI / app.py
Edl777's picture
Upload 3 files
02df179 verified
Raw History Blame Contribute Delete
7.65 kB
import streamlit as st
import pandas as pd
import time
from datetime import datetime
# NOTE: Since this Streamlit application replaces the command-line interface,
# we need to simulate the import of the processing logic (from main.py, extract_*, scorer.py).
# In a real scenario, you would integrate the content of those files into functions here,
# or ensure they are properly callable.
# We will simulate the 'process_urls' function which takes a list of URLs and returns a DataFrame.
def simulate_data_processing(urls):
"""
Simule la logique d'extraction et de scoring des profils.
Dans la version réelle, cette fonction appellerait extract_github.py, extract_so.py, et scorer.py.
"""
if not urls:
return pd.DataFrame()
data = []
# Simuler un traitement plus long pour montrer l'animation
progress_bar = st.progress(0)
status_text = st.empty()
for i, url in enumerate(urls):
# Simulation d'extraction et scoring
score = len(url) % 10 + 5 # Score basé sur la longueur de l'URL pour la simulation
platform = "GitHub" if "github.com" in url else "StackOverflow"
data.append({
"ID": i + 1,
"URL": url,
"Platforme": platform,
"Nom_Profil": url.split('/')[-1] if url.split('/')[-1] else "Anonyme",
"Score_Talent": score,
"Status": "Qualifié" if score >= 10 else "Nouveau"
})
# Mettre à jour la barre de progression
progress = (i + 1) / len(urls)
progress_bar.progress(progress)
status_text.text(f"🚀 Analyse en cours : {i+1}/{len(urls)} profils traités...")
time.sleep(0.1) # Simuler un délai de traitement
progress_bar.empty()
status_text.empty()
return pd.DataFrame(data)
# ---------------- CONFIGURATION ET THÈME PREMIUM ----------------
st.set_page_config(
page_title="Talent Data Engine | Digisphere LLC",
page_icon="🧠",
layout="wide"
)
# Thème foncé (Dark Mode) et styles personnalisés
st.markdown("""
<style>
/* 1. Global Dark Theme */
.stApp {
background-color: #1e1e1e; /* Fond très sombre */
color: #f0f0f0; /* Texte clair */
}
/* 2. Custom Header & Branding */
.main-header {
text-align: center;
padding: 20px 0 10px 0;
background: #282828; /* Barre de titre un peu moins sombre */
border-bottom: 3px solid #4a90e2; /* Accent bleu électrique */
margin-bottom: 20px;
}
.logo-text {
font-size: 2.5rem;
font-weight: 800;
color: #4a90e2; /* Couleur du logo */
letter-spacing: 2px;
display: inline-block;
}
.tagline {
color: #cccccc;
font-size: 1rem;
margin-top: 5px;
font-weight: 300;
}
/* 3. Button Styling (Action Button) */
.stButton>button {
background-color: #4a90e2;
color: white !important;
font-weight: bold;
border-radius: 8px;
border: none;
padding: 10px 20px;
transition: all 0.2s;
}
.stButton>button:hover {
background-color: #357bd9;
box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4); /* Ombre au survol */
}
/* 4. Text Area for Input (Key Feature) */
.stTextArea label {
font-size: 1.1rem;
color: #f0f0f0;
}
</style>
""", unsafe_allow_html=True)
# ---------------- HEADER ET LOGO ----------------
st.markdown("""
<div class="main-header">
<span class="logo-text">DIGISPHERE LLC</span>
<div class="tagline">TALENT DATA ENGINE — AI Sourcing Automation</div>
</div>
""", unsafe_allow_html=True)
# ---------------- MAIN LOGIC ----------------
st.markdown("## 📥 Saisie des URLs Source")
st.markdown("Collez les URLs des profils (GitHub, StackOverflow, etc.) à analyser, une URL par ligne.")
# Zone de saisie pour les URLs (plus professionnel qu'un fichier)
input_urls_text = st.text_area(
"Liste d'URLs",
placeholder="Exemple:\nhttps://github.com/torvalds\nhttps://stackoverflow.com/users/22656/jon-skeet",
height=200
)
# Séparation des URLs
urls_to_process = [url.strip() for url in input_urls_text.split('\n') if url.strip()]
st.markdown("---")
# ---------------- PARAMÈTRES D'AUTOMATISATION ----------------
st.markdown("### ⚙️ Paramètres d'Automatisation (Licence Entreprise)")
col_check, col_info = st.columns([1, 2])
with col_check:
auto_refresh_enabled = st.checkbox("Activer l'Auto-Mise à Jour (toutes les 6h)", value=False)
with col_info:
if auto_refresh_enabled:
# Note pour rappeler la nature SaaS de cette fonctionnalité
st.markdown(
"""
<div style='background-color: #35424a; padding: 10px; border-radius: 6px; color: #e0e0e0;'>
⚙️ **Statut :** L'automatisation est active. Cette fonction nécessite que l'application soit déployée sur un serveur (type CRON ou Worker) pour fonctionner en arrière-plan sans intervention manuelle.
</div>
""",
unsafe_allow_html=True
)
else:
st.caption("L'automatisation met à jour votre Dataset Premium périodiquement via une configuration serveur dédiée.")
# Bouton de lancement
if st.button("🧠 Lancer l'Analyse du Talent Data Engine"):
if not urls_to_process:
st.warning("⚠️ Veuillez entrer au moins une URL à analyser.")
else:
st.info(f"Démarrage de l'analyse pour {len(urls_to_process)} profils...")
# Le traitement avec l'animation
df_results = simulate_data_processing(urls_to_process)
st.success("✅ Analyse complétée ! Dataset Premium généré.")
st.session_state['results_df'] = df_results
st.session_state['last_run'] = datetime.now()
# ---------------- AFFICHAGE DES RÉSULTATS ----------------
if 'results_df' in st.session_state and not st.session_state['results_df'].empty:
df = st.session_state['results_df']
st.markdown("## 📊 Dataset Premium (Profils Classés)")
st.markdown(f"**Dernière exécution :** {st.session_state['last_run'].strftime('%Y-%m-%d %H:%M:%S')}")
# Affichage des résultats
st.dataframe(df.sort_values(by="Score_Talent", ascending=False), use_container_width=True, height=350)
# Bouton de téléchargement
st.download_button(
label="⬇️ Télécharger le Dataset CSV",
data=df.to_csv(index=False).encode("utf-8"),
file_name=f"digisphere_talent_data_{datetime.now().strftime('%Y%m%d_%H%M')}.csv",
mime="text/csv",
key='download_button'
)
st.markdown("---")
# ---------------- SECTION À PROPOS ET FOOTER ----------------
with st.expander("ℹ️ À Propos du Talent Data Engine", expanded=False):
st.markdown("""
Le **Talent Data Engine** est la solution logicielle phare de **Digisphere LLC**.
Conçu pour les professionnels du recrutement et les dirigeants d'entreprises tech,
il utilise des algorithmes exclusifs pour :
* Analyser la profondeur technique et la contribution des profils tech.
* Attribuer un **Score Talent** (de 1 à 15) pour une qualification rapide.
* Créer des datasets structurés prêts à l'emploi.
Pour toute licence entreprise, support ou personnalisation : **contact@digispherellc.com**.
""", unsafe_allow_html=True)
st.markdown(
"""<div style="text-align: center; color: #888888; padding: 10px; font-size: 0.8rem;">
© 2025 Digisphere LLC — Software Solution License v1.0
</div>""",
unsafe_allow_html=True
)