from transformers import pipeline import gradio as gr generator = pipeline( "text2text-generation", model="google/flan-t5-small" ) def career_advice(age, academic_level, interests, needs_income): prompt = f""" You are an expert career advisor. A student has the following data: - Age: {age} - Academic level: {academic_level} - Interests: {interests} - Needs income: {needs_income} Give a clear, realistic, and motivating recommendation about whether the student should: - Continue studying - Do vocational training (FP) - Start working Explain the reasoning behind your recommendation. """ result = generator(prompt, max_length=200) return result[0]['generated_text'] interface = gr.Interface( fn=career_advice, inputs=[ gr.Number(label="Age"), gr.Textbox(label="Academic level"), gr.Textbox(label="Interests"), gr.Dropdown(choices=["Yes", "No"], label="Needs income") ], outputs=gr.Textbox(label="Recommendation"), title="Career Advisor for Students" ) interface.launch()