Spaces:
Sleeping

resume_aiagent / app.py
Nannu21's picture
Create app.py
87d0222 verified
Raw History Blame Contribute Delete
1.27 kB
import gradio as gr
from transformers import pipeline
# Load a small, free, instruction-tuned model
generator = pipeline(
"text-generation",
model="google/flan-t5-large",
max_new_tokens=250
)
def generate_interview_questions(job_role, level, count):
prompt = f"""
You are an interview expert AI agent.
Generate {count} interview questions, answers, and tips for the job role: {job_role}.
Difficulty level: {level}.
Format:
Q1:
Answer:
Tip:
Q2:
Answer:
Tip:
Keep it clear, simple, and helpful.
"""
output = generator(prompt)[0]["generated_text"]
return output
# --------- Gradio UI ----------
with gr.Blocks(theme=gr.themes.Soft()) as demo:
gr.Markdown("<h1 style='text-align:center;'>Interview Question Generator Agent</h1>")
with gr.Row():
job = gr.Textbox(label="Job Role", placeholder="e.g., Python Developer, Data Analyst")
level = gr.Radio(["Beginner", "Intermediate", "Advanced"], label="Difficulty Level", value="Beginner")
count = gr.Slider(3, 15, value=5, label="Number of Questions")
btn = gr.Button("Generate")
output = gr.Textbox(label="Generated Interview Questions", lines=20)
btn.click(generate_interview_questions, inputs=[job, level, count], outputs=output)
demo.launch()