import streamlit as st import requests from config import settings import streamlit.components.v1 as components def correct_text(text): url = f"{settings.BACKEND_URL}/corriger" response = requests.post(url, json={"text": text}) if response.status_code != 200: st.error("Erreur lors de la requête au serveur: {response.status_code}") return "" else: return response.json()["text"] def main(): st.title("Application Point Médian") with open("ressources/header.md", "r") as f: st.markdown(f.read(), unsafe_allow_html=False) text = st.text_area("Entre le texte à corriger", placeholder="Écris ton texte ici", height=200) if st.button("Corriger"): corrected_text = correct_text(text) st.text_area("Texte corrigé:", value=corrected_text, height=200) with open("ressources/formulaire_courriel.html", "r") as f: components.html(f.read(), height=350, scrolling=True) with open("ressources/footer.md", "r") as f: st.markdown(f.read(), unsafe_allow_html=False) if __name__ == "__main__": main()