Mariam-anglais / app.py
Docfile's picture
Update app.py
25f0e13 verified
raw
history blame
4.7 kB
import streamlit as st
from PIL import Image
import numpy as np
# Configuration de la page
st.set_page_config(
page_title="Mariam Anglais",
page_icon="🇬🇧",
layout="wide",
initial_sidebar_state="expanded"
)
# --- Fonctions pour effets visuels ---
def gradient_background(start_color, end_color):
"""Génère un fond dégradé."""
st.markdown(
f"""
<style>
body {{
background: linear-gradient(to right, {start_color}, {end_color});
background-size: 120% 120%;
animation: gradient 5s ease infinite;
}}
@keyframes gradient {{
0% {{ background-position: 0% 50%; }}
50% {{ background-position: 100% 50%; }}
100% {{ background-position: 0% 50%; }}
}}
</style>
""",
unsafe_allow_html=True
)
def neon_effect(text, color):
"""Ajoute un effet néon à un texte."""
return f"<span style='color: {color}; text-shadow: 0 0 5px {color};'>{text}</span>"
# --- Couleurs ---
start_color = "#0078D7" # Bleu Microsoft
end_color = "#00B294" # Vert émeraude
text_color = "#FFFFFF" # Blanc
neon_blue = "#66CCFF" # Bleu néon
# --- Appliquer le fond dégradé ---
gradient_background(start_color, end_color)
# --- CSS Personnalisé ---
st.markdown(
f"""
<style>
.stApp {{
font-family: 'Segoe UI', sans-serif;
}}
.stFileUploader {{
padding: 1.5rem;
border: 3px dashed {neon_blue};
border-radius: 1rem;
}}
.stRadio>div>label {{
font-weight: 600;
color: {text_color};
padding: 0.75rem 1.5rem;
margin-bottom: 0.5rem;
border-radius: 0.5rem;
border: 2px solid {neon_blue};
background-color: rgba(0, 0, 0, 0.2);
}}
.stRadio>div>label:hover {{
background-color: {neon_blue};
color: black;
}}
.stButton>button {{
background-color: {neon_blue};
color: black;
padding: 0.75rem 1.5rem;
border-radius: 0.5rem;
font-weight: bold;
box-shadow: 0 0 10px {neon_blue};
transition: all 0.3s ease;
}}
.stButton>button:hover {{
transform: scale(1.05);
box-shadow: 0 0 15px {neon_blue};
}}
.st-bb {{
border-bottom: 3px solid {neon_blue};
}}
.st-eb, .st-ec, .st-ed, .st-ee, .st-ef, .st-eg, .st-eh, .st-ei, .st-ej {{
color: {text_color};
}}
.uploadedFiles {{
color: {neon_blue}
}}
.uploadedFile {{
color: {neon_blue};
font-weight: bold;
}}
</style>
""",
unsafe_allow_html=True
)
# --- Titre avec effet néon ---
st.title(neon_effect("✨ Mariam Anglais ✨", neon_blue))
# --- Introduction ---
st.markdown(f"<p style='color: {text_color}; font-size: 1.2rem;'>Bienvenue sur votre plateforme d'analyse d'images intelligente ! Téléchargez vos images, choisissez votre type d'analyse, et laissez la magie opérer.</p>", unsafe_allow_html=True)
# --- Colonnes ---
col1, col2 = st.columns(2)
with col1:
# --- Téléchargement d'images ---
uploaded_files = st.file_uploader("Choisissez des images", type=["jpg", "jpeg", "png"], accept_multiple_files=True)
# --- Effet sur les images téléchargées ---
if uploaded_files:
st.write(f"<p style='color: {neon_blue}; font-weight: bold; font-size: 1.1rem;'>Aperçu des images :</p>", unsafe_allow_html=True)
for uploaded_file in uploaded_files:
img = Image.open(uploaded_file)
img = np.array(img)
st.image(img, width=200, use_column_width='auto', output_format='JPEG')
with col2:
# --- Choix du type d'analyse avec effet néon ---
analysis_type = st.radio("Choisissez le type d'analyse :",
(neon_effect("🔍 Type 1", neon_blue), neon_effect("🧠 Type 2", neon_blue)))
# --- Bouton de soumission avec effet néon ---
if st.button("🚀 Soumettre"):
if uploaded_files:
st.write(f"<p style='color: {text_color};'>Type d'analyse sélectionné : {analysis_type}</p>", unsafe_allow_html=True)
with st.spinner(neon_effect("Analyse en cours...", neon_blue)):
# Insérez ici le code pour effectuer l'analyse d'image
import time
time.sleep(3)
st.success(neon_effect("✅ Analyse terminée !", neon_blue))
else:
st.warning(neon_effect("⚠️ Veuillez télécharger au moins une image.", neon_blue))
# --- Pied de page ---
st.markdown("---")
st.write(f"<p style='color: {text_color};'>© 2023 Mariam Anglais - Tous droits réservés.</p>", unsafe_allow_html=True)