Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,6 @@ import streamlit.components.v1 as stc
|
|
| 3 |
import pandas as pd
|
| 4 |
from sklearn.feature_extraction.text import CountVectorizer
|
| 5 |
from sklearn.metrics.pairwise import cosine_similarity,linear_kernel
|
| 6 |
-
|
| 7 |
import re
|
| 8 |
import pandas as pd
|
| 9 |
import numpy as np
|
|
@@ -12,17 +11,96 @@ import neattext.functions as nfx
|
|
| 12 |
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
|
| 13 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 14 |
import warnings
|
| 15 |
-
|
| 16 |
|
| 17 |
warnings.filterwarnings("ignore")
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
data["titre_OK"]= data.course_title.apply(nfx.remove_stopwords)
|
| 20 |
data["titre_OK"]= data.course_title.apply(nfx.remove_special_characters)
|
| 21 |
countVec= CountVectorizer()
|
| 22 |
cv= countVec.fit_transform(data.titre_OK)
|
| 23 |
df=data
|
| 24 |
matrice_cosine= cosine_similarity(cv)
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
def recommend_course2(title, numrec=10):
|
| 27 |
try:
|
| 28 |
pattern = re.compile(re.escape(title), re.IGNORECASE)
|
|
@@ -42,33 +120,55 @@ def recommend_course2(title, numrec=10):
|
|
| 42 |
return final_recommended_courses.head(numrec)
|
| 43 |
|
| 44 |
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
num_of_rec = st.sidebar.number_input("Nombre de cours",4,30,7)
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
|
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
from sklearn.feature_extraction.text import CountVectorizer
|
| 5 |
from sklearn.metrics.pairwise import cosine_similarity,linear_kernel
|
|
|
|
| 6 |
import re
|
| 7 |
import pandas as pd
|
| 8 |
import numpy as np
|
|
|
|
| 11 |
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
|
| 12 |
from sklearn.metrics.pairwise import cosine_similarity
|
| 13 |
import warnings
|
| 14 |
+
from streamlit_extras.dataframe_explorer import dataframe_explorer ,generate_fake_dataframe
|
| 15 |
|
| 16 |
warnings.filterwarnings("ignore")
|
| 17 |
+
APP_TITLE="TO_ME_FOR_ME"
|
| 18 |
+
APP_LOGO="requirement-confidential-develop-extend-proof.jpg"
|
| 19 |
+
st.set_page_config(layout="wide", page_title=APP_TITLE, page_icon=APP_LOGO,initial_sidebar_state="expanded")
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
@st.cache_data
|
| 23 |
+
def loadDataframe(path):
|
| 24 |
+
return pd.read_csv(path)
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
data=loadDataframe("udemy_courses.csv")
|
| 28 |
+
|
| 29 |
data["titre_OK"]= data.course_title.apply(nfx.remove_stopwords)
|
| 30 |
data["titre_OK"]= data.course_title.apply(nfx.remove_special_characters)
|
| 31 |
countVec= CountVectorizer()
|
| 32 |
cv= countVec.fit_transform(data.titre_OK)
|
| 33 |
df=data
|
| 34 |
matrice_cosine= cosine_similarity(cv)
|
| 35 |
+
parameters = {
|
| 36 |
+
"Personnalisation Précise": {
|
| 37 |
+
"description": """
|
| 38 |
+
**Description:** Les systèmes de recommandation intelligents analysent vos compétences, vos intérêts, et vos objectifs professionnels pour offrir des suggestions de formation parfaitement adaptées.
|
| 39 |
+
**Rôle:** Ce paramètre est crucial car il vous permet de recevoir des recommandations sur mesure, optimisant ainsi la pertinence des formations suggérées.
|
| 40 |
+
""",
|
| 41 |
+
"image": "standard-quality-control-concept-m (1).jpg"
|
| 42 |
+
},
|
| 43 |
+
"Gain de Temps": {
|
| 44 |
+
"description": """
|
| 45 |
+
**Description:** La recherche de la formation idéale peut être chronophage. Un système intelligent simplifie ce processus en vous orientant directement vers les programmes les plus appropriés.
|
| 46 |
+
**Rôle:** Ce paramètre permet de réduire le temps passé à rechercher et à comparer les options de formation, vous permettant de vous concentrer sur l'apprentissage.
|
| 47 |
+
""",
|
| 48 |
+
"image": "standard-quality-control-concept-m (2).jpg"
|
| 49 |
+
},
|
| 50 |
+
"Suivi et Adaptation Continue": {
|
| 51 |
+
"description": """
|
| 52 |
+
**Description:** Les systèmes avancés suivent vos progrès, évaluent les résultats obtenus et ajustent les recommandations en fonction de votre évolution.
|
| 53 |
+
**Rôle:** Ce paramètre permet d'ajuster les suggestions en temps réel, vous offrant un accompagnement continu et personnalisé tout au long de votre parcours de formation.
|
| 54 |
+
""",
|
| 55 |
+
"image": "programming-background-with-person-working-with-codes-computer.jpg"
|
| 56 |
+
},
|
| 57 |
+
}
|
| 58 |
+
params= {
|
| 59 |
+
"Réponse aux Évolutions du Marché": {
|
| 60 |
+
"description": """
|
| 61 |
+
**Description:** Les systèmes de recommandation intelligents ajustent leurs suggestions en fonction des tendances actuelles et des évolutions du secteur.
|
| 62 |
+
**Rôle:** Ce paramètre garantit que vous restez à la pointe des compétences demandées, vous aidant ainsi à répondre aux exigences du marché du travail en constante évolution.
|
| 63 |
+
""",
|
| 64 |
+
"image": "standard-quality-control-concept-m.jpg"
|
| 65 |
+
},
|
| 66 |
+
"Suivi et Adaptation Continue": {
|
| 67 |
+
"description": """
|
| 68 |
+
**Description:** Les systèmes avancés suivent vos progrès, évaluent les résultats obtenus et ajustent les recommandations en fonction de votre évolution.
|
| 69 |
+
**Rôle:** Ce paramètre permet d'ajuster les suggestions en temps réel, vous offrant un accompagnement continu et personnalisé tout au long de votre parcours de formation.
|
| 70 |
+
""",
|
| 71 |
+
"image": "programming-background-with-person-working-with-codes-computer.jpg"
|
| 72 |
+
},
|
| 73 |
+
"Amélioration de la Pertinence": {
|
| 74 |
+
"description": """
|
| 75 |
+
**Description:** En s'appuyant sur des données et des algorithmes sophistiqués, les systèmes réduisent les erreurs de jugement humaines et optimisent vos investissements en temps et en ressources.
|
| 76 |
+
**Rôle:** Ce paramètre assure que les recommandations sont basées sur des analyses précises et pertinentes, maximisant ainsi l'efficacité de vos choix de formation.
|
| 77 |
+
""",
|
| 78 |
+
"image": "cloud-storage-background-remixed-from-public-domain-by-nasa.jpg"
|
| 79 |
+
}
|
| 80 |
+
}
|
| 81 |
+
DESCRIPTION = """
|
| 82 |
+
<h2 style='color: #7D7D7D;'>Optimisez Votre Parcours de Formation avec Précision
|
| 83 |
+
Grace à un système de recommandation Intelligent
|
| 84 |
+
</h2>
|
| 85 |
+
<p>
|
| 86 |
+
Dans un monde où les opportunités d'apprentissage sont aussi vastes que variées, choisir
|
| 87 |
+
la formation adéquate peut s'avérer un véritable défi. C’est là qu’un système de recommandation
|
| 88 |
+
intelligent entre en jeu. En combinant technologie avancée et compréhension fine de vos besoins
|
| 89 |
+
, il transforme le processus de sélection de formation en une expérience personnalisée et efficace.
|
| 90 |
+
</p>
|
| 91 |
+
<p>Notre technologie avancée utilise des algorithmes intelligents pour analyser vos
|
| 92 |
+
compétences actuelles, vos intérêts professionnels et vos aspirations futures. Grâce à
|
| 93 |
+
ces informations, nous vous proposons des formations personnalisées qui maximisent votre potentiel
|
| 94 |
+
de croissance et vous aident à rester
|
| 95 |
+
compétitif dans un monde en constante évolution. L’intégration d’un système de recommandation intelligent dans votre processus
|
| 96 |
+
de formation vous permet non seulement de gagner en efficacité, mais aussi d’accroître
|
| 97 |
+
votre satisfaction et votre réussite. Il vous offre une voie claire vers
|
| 98 |
+
l’acquisition des compétences dont vous avez besoin pour exceller dans votre carrière.
|
| 99 |
+
</p>
|
| 100 |
+
|
| 101 |
+
"""
|
| 102 |
+
|
| 103 |
+
@st.cache_data
|
| 104 |
def recommend_course2(title, numrec=10):
|
| 105 |
try:
|
| 106 |
pattern = re.compile(re.escape(title), re.IGNORECASE)
|
|
|
|
| 120 |
return final_recommended_courses.head(numrec)
|
| 121 |
|
| 122 |
|
| 123 |
+
MenuNavigation = ["🏠Accueil", "🤺Simulation", "A propos"]
|
| 124 |
+
st.sidebar.image(APP_LOGO, width=255)
|
| 125 |
+
|
| 126 |
+
userChoice= st.sidebar.selectbox("Menu",MenuNavigation)
|
| 127 |
+
if userChoice== MenuNavigation[0]:
|
| 128 |
+
st.markdown("<h1 style='text-align:center;color: #f27f88; text-transform: uppercase; text-tranform:underline,'><u>{} </u></h1>".format(APP_TITLE),unsafe_allow_html=True)
|
| 129 |
+
st.markdown("<p style='text-align:center; color: gray;'><i>Pour une formation de Qualité</i></p>", unsafe_allow_html=True)
|
| 130 |
+
st.markdown("<h1 style='text-align:center;color: #f27f88; text-transform: uppercase; text-tranform:underline,'>{}: La meilleure approche pour votre Formation</h1>".format(APP_TITLE),unsafe_allow_html=True)
|
| 131 |
+
column, column2= st.columns((1,2))
|
| 132 |
+
with column:
|
| 133 |
+
st.image(APP_LOGO)
|
| 134 |
+
with column2:
|
| 135 |
+
st.write(DESCRIPTION, unsafe_allow_html=True)
|
| 136 |
+
st.markdown("<h1 style='text-align:center; text-transform: uppercase; text-tranform:underline; color: #f27f88'>Pourquoi un Système de Recommandation Intelligent est Essentiel ?</h1>",unsafe_allow_html=True)# affiche des titres html
|
| 137 |
+
firstCol , secondCol= st.columns((1,1))
|
| 138 |
+
with firstCol:
|
| 139 |
+
for param, info in parameters.items():
|
| 140 |
+
col1x, col2x = st.columns([1, 3]) # Define columns with relative widths
|
| 141 |
+
with col1x:
|
| 142 |
+
st.image(info['image'],use_column_width=True) # width as needed
|
| 143 |
+
with col2x:
|
| 144 |
+
st.markdown(f"""
|
| 145 |
+
### **{param}**
|
| 146 |
+
{info['description']}
|
| 147 |
+
""", unsafe_allow_html=True)
|
| 148 |
+
with secondCol:
|
| 149 |
+
for param, info in params.items():
|
| 150 |
+
col1x, col2x = st.columns([1, 3]) # Define columns with relative widths
|
| 151 |
+
with col1x:
|
| 152 |
+
st.image(info['image'],use_column_width=True) # width as needed
|
| 153 |
+
with col2x:
|
| 154 |
+
st.markdown(f"""
|
| 155 |
+
### **{param}**
|
| 156 |
+
{info['description']}
|
| 157 |
+
""", unsafe_allow_html=True)
|
| 158 |
+
elif userChoice==MenuNavigation[1]:
|
| 159 |
+
st.markdown("<h1 style='text-align:center; text-transform: uppercase; text-tranform:underline; color: #f27f88'>Besoin d'une recommandation?</h1>",unsafe_allow_html=True)
|
| 160 |
+
search_term = st.text_input("Entrez le cours")
|
| 161 |
num_of_rec = st.sidebar.number_input("Nombre de cours",4,30,7)
|
| 162 |
+
filteredData= dataframe_explorer(recommend_course2(search_term, num_of_rec), case=False)
|
| 163 |
+
st.dataframe(filteredData,use_container_width=True,hide_index=True)
|
| 164 |
+
|
| 165 |
+
elif userChoice== MenuNavigation[2]:
|
| 166 |
+
st.header("DataSet utilisé pour ce travail en Vue de l'obtention du diplome de Bachelor en Intelligence Artificielle et Big Data ")
|
| 167 |
+
filteredDatas= dataframe_explorer(df.drop("url", axis=1), case=False)
|
| 168 |
+
st.dataframe(filteredDatas, use_container_width=True)
|
| 169 |
+
st.caption("<h4 style='text-align: center;'> Copyrigth @2024 Djitsep Alsira KinKeu</h4>", unsafe_allow_html=True)
|
| 170 |
+
|
| 171 |
+
# if search_term:
|
| 172 |
+
# filtered_DataFrame= dataframe_explorer(df, case=False)
|
| 173 |
+
# st.dataframe(filtered_DataFrame, use_container_width=True)
|
| 174 |
+
# st.write(recommend_course2(search_term, num_of_rec))
|