Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from transformers import pipeline | |
| # Chargez un modèle pré-entrainé pour le français | |
| correcteur = pipeline("text2text-generation", model="moussaKam/barthez-orangesum-title") | |
| def corrige_texte(texte): | |
| # Personnalisez cette partie pour le TCF | |
| prompt = f"Corrige ce texte TCF en français, explique les erreurs : {texte}" | |
| correction = correcteur(prompt, max_length=400)[0]['generated_text'] | |
| return f""" | |
| <div style='border:1px solid #4361ee; padding:20px; border-radius:8px'> | |
| <h3>Correction :</h3> | |
| <p>{correction.split("Corrige ce texte TCF")[-1]}</p> | |
| <p style='color:#4361ee'><i>Correcteur TCF SupFLE</i></p> | |
| </div> | |
| """ | |
| # Interface simple | |
| interface = gr.Interface( | |
| fn=corrige_texte, | |
| inputs=gr.Textbox(label="Entrez votre texte TCF", lines=5), | |
| outputs=gr.HTML(label="Correction"), | |
| title="<img src='https://www.supdefle.com/votre-logo.png' width='100'><br>Correcteur TCF", | |
| examples=[ | |
| ["Je vais au cinéma hier"], | |
| ["Les enfant joue dans le parc"] | |
| ] | |
| ) | |
| interface.launch() |