Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -159,16 +159,17 @@ def main():
|
|
| 159 |
st.sidebar.header("Fonctionnalités")
|
| 160 |
menu_option = st.sidebar.selectbox(
|
| 161 |
"Choisissez une fonctionnalité",
|
| 162 |
-
["Accueil", "
|
| 163 |
format_func=lambda x: {
|
| 164 |
"Accueil": "🏠 Accueil",
|
| 165 |
-
"
|
| 166 |
"Cropping": "✂️ Cropping",
|
| 167 |
"Rotation": "🔄 Rotation",
|
| 168 |
"Floutage": "🌫️ Floutage",
|
| 169 |
"Contours": "🔍 Contours",
|
| 170 |
"Génération de Code-barres et QR Code": "📇 Codes numériques",
|
| 171 |
-
"Détection Faciale": "🙂 Détection Faciale"
|
|
|
|
| 172 |
}.get(x, x)
|
| 173 |
)
|
| 174 |
|
|
@@ -192,20 +193,8 @@ def main():
|
|
| 192 |
unsafe_allow_html=True
|
| 193 |
)
|
| 194 |
|
| 195 |
-
|
| 196 |
-
st.
|
| 197 |
-
"""
|
| 198 |
-
| **Nom** | **Niveau** |
|
| 199 |
-
|------------------------|---------------------------|
|
| 200 |
-
| **Ngoue David** | Master 2 Intelligence Artificielle et Big Data |
|
| 201 |
-
| **Bidzanga Armel** | Master 2 Intelligence Artificielle et Big Data |
|
| 202 |
-
| **Nziou Serena** | Master 2 Administration de Systèmes d'Information |
|
| 203 |
-
""",
|
| 204 |
-
unsafe_allow_html=True
|
| 205 |
-
)
|
| 206 |
-
|
| 207 |
-
elif menu_option == "Transformations d'image":
|
| 208 |
-
st.subheader("Transformations d'image")
|
| 209 |
|
| 210 |
tab1, tab2, tab3, tab4 = st.tabs([
|
| 211 |
"Gris 🖤", "Rouge ❤️", "Vert 💚", "Jaune 💛"
|
|
@@ -344,49 +333,78 @@ def main():
|
|
| 344 |
elif menu_option == "Génération de Code-barres et QR Code":
|
| 345 |
st.subheader("Génération de Code-barres et QR Code")
|
| 346 |
|
| 347 |
-
#
|
| 348 |
-
|
| 349 |
-
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
-
|
| 369 |
-
|
| 370 |
-
|
| 371 |
-
|
| 372 |
-
|
| 373 |
-
|
| 374 |
-
|
| 375 |
-
|
| 376 |
-
|
| 377 |
-
|
| 378 |
-
|
| 379 |
-
|
| 380 |
-
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
|
| 384 |
-
|
| 385 |
-
|
| 386 |
-
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 390 |
|
| 391 |
elif menu_option == "Détection Faciale":
|
| 392 |
st.subheader("Détection Faciale")
|
|
@@ -472,6 +490,42 @@ def main():
|
|
| 472 |
st.image(frame, caption="Vidéo avec Visages Détectés", use_container_width=True)
|
| 473 |
|
| 474 |
cap.release()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 475 |
|
| 476 |
|
| 477 |
if __name__ == "__main__":
|
|
|
|
| 159 |
st.sidebar.header("Fonctionnalités")
|
| 160 |
menu_option = st.sidebar.selectbox(
|
| 161 |
"Choisissez une fonctionnalité",
|
| 162 |
+
["Accueil", "Niveaux de couleurs", "Cropping", "Rotation", "Floutage", "Contours", "Génération de Code-barres et QR Code", "Détection Faciale", "À propos de nous"],
|
| 163 |
format_func=lambda x: {
|
| 164 |
"Accueil": "🏠 Accueil",
|
| 165 |
+
"Niveaux de couleurs": "🖼️ Niveaux de couleurs",
|
| 166 |
"Cropping": "✂️ Cropping",
|
| 167 |
"Rotation": "🔄 Rotation",
|
| 168 |
"Floutage": "🌫️ Floutage",
|
| 169 |
"Contours": "🔍 Contours",
|
| 170 |
"Génération de Code-barres et QR Code": "📇 Codes numériques",
|
| 171 |
+
"Détection Faciale": "🙂 Détection Faciale",
|
| 172 |
+
"À propos de nous": "👨💻 À propos de nous"
|
| 173 |
}.get(x, x)
|
| 174 |
)
|
| 175 |
|
|
|
|
| 193 |
unsafe_allow_html=True
|
| 194 |
)
|
| 195 |
|
| 196 |
+
elif menu_option == "Niveaux de couleurs":
|
| 197 |
+
st.subheader("iveaux de couleurs")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
|
| 199 |
tab1, tab2, tab3, tab4 = st.tabs([
|
| 200 |
"Gris 🖤", "Rouge ❤️", "Vert 💚", "Jaune 💛"
|
|
|
|
| 333 |
elif menu_option == "Génération de Code-barres et QR Code":
|
| 334 |
st.subheader("Génération de Code-barres et QR Code")
|
| 335 |
|
| 336 |
+
# Légende pour guider l'utilisateur
|
| 337 |
+
st.markdown(
|
| 338 |
+
"""
|
| 339 |
+
🔄 **Instructions :**
|
| 340 |
+
1. Saisis un lien ou un texte dans le champ ci-dessous.
|
| 341 |
+
2. Accède à l'onglet souhaité pour générer un **Code-barres** 📊 ou un **QR Code** 📱.
|
| 342 |
+
3. Clique sur le bouton **"Générer"** pour voir le résultat et utilise le bouton **⬇️ Télécharger** pour sauvegarder l'image.
|
| 343 |
+
"""
|
| 344 |
+
)
|
| 345 |
+
|
| 346 |
+
# Gestion de l'entrée utilisateur avec sauvegarde dans session_state
|
| 347 |
+
if "link" not in st.session_state:
|
| 348 |
+
st.session_state["link"] = ""
|
| 349 |
+
|
| 350 |
+
# Entrée utilisateur
|
| 351 |
+
link = st.text_input("🔗 Entre un lien ou un texte pour générer les codes", value=st.session_state["link"])
|
| 352 |
+
if link:
|
| 353 |
+
st.session_state["link"] = link
|
| 354 |
+
|
| 355 |
+
# Création des onglets
|
| 356 |
+
tab1, tab2 = st.tabs(["📊 Code-barres", "📱 QR Code"])
|
| 357 |
+
|
| 358 |
+
# Onglet Code-barres
|
| 359 |
+
with tab1:
|
| 360 |
+
st.header("📊 Génération de Code-barres")
|
| 361 |
+
if st.button("Générer le Code-barres"):
|
| 362 |
+
if st.session_state["link"]:
|
| 363 |
+
try:
|
| 364 |
+
# Génération du code-barres
|
| 365 |
+
barcode_image = generate_barcode(st.session_state["link"])
|
| 366 |
+
st.image(barcode_image, caption="Code-barres généré", use_container_width=True)
|
| 367 |
+
|
| 368 |
+
# Bouton de téléchargement avec icône
|
| 369 |
+
barcode_buffer = BytesIO()
|
| 370 |
+
barcode_image.save(barcode_buffer, format="PNG")
|
| 371 |
+
barcode_buffer.seek(0)
|
| 372 |
+
st.download_button(
|
| 373 |
+
label="⬇️ Télécharger le Code-barres",
|
| 374 |
+
data=barcode_buffer,
|
| 375 |
+
file_name="barcode.png",
|
| 376 |
+
mime="image/png"
|
| 377 |
+
)
|
| 378 |
+
except Exception as e:
|
| 379 |
+
st.error(f"Une erreur est survenue lors de la génération : {e}")
|
| 380 |
+
else:
|
| 381 |
+
st.warning("⚠️ Veuillez entrer un lien ou un texte valide.")
|
| 382 |
+
|
| 383 |
+
# Onglet QR Code
|
| 384 |
+
with tab2:
|
| 385 |
+
st.header("📱 Génération de QR Code")
|
| 386 |
+
if st.button("Générer le QR Code"):
|
| 387 |
+
if st.session_state["link"]:
|
| 388 |
+
try:
|
| 389 |
+
# Génération du QR Code
|
| 390 |
+
qrcode_image = generate_qrcode(st.session_state["link"])
|
| 391 |
+
st.image(qrcode_image, caption="QR Code généré", use_container_width=True)
|
| 392 |
+
|
| 393 |
+
# Bouton de téléchargement avec icône
|
| 394 |
+
qrcode_buffer = BytesIO()
|
| 395 |
+
qrcode_image.save(qrcode_buffer, format="PNG")
|
| 396 |
+
qrcode_buffer.seek(0)
|
| 397 |
+
st.download_button(
|
| 398 |
+
label="⬇️ Télécharger le QR Code",
|
| 399 |
+
data=qrcode_buffer,
|
| 400 |
+
file_name="qrcode.png",
|
| 401 |
+
mime="image/png"
|
| 402 |
+
)
|
| 403 |
+
except Exception as e:
|
| 404 |
+
st.error(f"Une erreur est survenue lors de la génération : {e}")
|
| 405 |
+
else:
|
| 406 |
+
st.warning("⚠️ Veuillez entrer un lien ou un texte valide.")
|
| 407 |
+
|
| 408 |
|
| 409 |
elif menu_option == "Détection Faciale":
|
| 410 |
st.subheader("Détection Faciale")
|
|
|
|
| 490 |
st.image(frame, caption="Vidéo avec Visages Détectés", use_container_width=True)
|
| 491 |
|
| 492 |
cap.release()
|
| 493 |
+
|
| 494 |
+
elif menu_option == "À propos de nous":
|
| 495 |
+
st.header("À propos de nous")
|
| 496 |
+
st.markdown(
|
| 497 |
+
"""
|
| 498 |
+
<div style="text-align:center; font-family: Arial; margin: 20px 0;">
|
| 499 |
+
<h2>Notre équipe</h2>
|
| 500 |
+
<p>Nous sommes une équipe passionnée travaillant sur des solutions innovantes.</p>
|
| 501 |
+
</div>
|
| 502 |
+
<div style="display: flex; justify-content: center; gap: 30px; flex-wrap: wrap;">
|
| 503 |
+
<div style="text-align: center;">
|
| 504 |
+
<img src="https://avatars.githubusercontent.com/u/1234567" alt="Ngoue David" style="width: 150px; height: 150px; border-radius: 50%;">
|
| 505 |
+
<h4>Ngoue David</h4>
|
| 506 |
+
<p>🎓 Master 2 IA & Big Data</p>
|
| 507 |
+
<p>📧 <a href="mailto:ngouedavidrogeryannick@gmail.com">ngouedavidrogeryannick@gmail.com</a></p>
|
| 508 |
+
<p>🌐 <a href="https://github.com/TheBeyonder237" target="_blank">Profil GitHub</a></p>
|
| 509 |
+
</div>
|
| 510 |
+
<div style="text-align: center;">
|
| 511 |
+
<img src="https://avatars.githubusercontent.com/u/7654321" alt="Bidzanga Armel" style="width: 150px; height: 150px; border-radius: 50%;">
|
| 512 |
+
<h4>Bidzanga Armel</h4>
|
| 513 |
+
<p>🎓 Master 2 IA & Big Data</p>
|
| 514 |
+
<p>📧 <a href="mailto:armelmbia08@gmail.com">armel.bidzanga@adsvisor.com</a></p>
|
| 515 |
+
<p>🌐 <a href="https://github.com/armelbidzanga" target="_blank">Profil GitHub</a></p>
|
| 516 |
+
</div>
|
| 517 |
+
<div style="text-align: center;">
|
| 518 |
+
<img src="https://avatars.githubusercontent.com/u/9876543" alt="Nziou Serena" style="width: 150px; height: 150px; border-radius: 50%;">
|
| 519 |
+
<h4>Nziou Serena</h4>
|
| 520 |
+
<p>🎓 Master 2 Administration Systèmes</p>
|
| 521 |
+
<p>📧 <a href="mailto:serena.nziou@adsvisor.com">serena.nziou@adsvisor.com</a></p>
|
| 522 |
+
<p>🌐 <a href="https://github.com/nziouserena" target="_blank">Profil GitHub</a></p>
|
| 523 |
+
</div>
|
| 524 |
+
</div>
|
| 525 |
+
""",
|
| 526 |
+
unsafe_allow_html=True
|
| 527 |
+
)
|
| 528 |
+
|
| 529 |
|
| 530 |
|
| 531 |
if __name__ == "__main__":
|