Spaces:
No application file
No application file
File size: 1,051 Bytes
43a3eff |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
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()
|