Spaces:
Sleeping
Sleeping
Download app.py from Nannu21/resume_agent: direct link, hf CLI and curl.
- Browser
- Download file 1.45 kB
-
https://huggingface.co/spaces/Nannu21/resume_agent/resolve/main/app.py
- Command line
-
hf download hf://spaces/Nannu21/resume_agent/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Nannu21/resume_agent/resolve/main/app.py
1.45 kB
| import gradio as gr | |
| from transformers import pipeline | |
| # Load FLAN-T5-base (works on CPU) | |
| generator = pipeline( | |
| task="text2text-generation", | |
| model="google/flan-t5-base" | |
| ) | |
| def generate_interview_questions(job_role, level, count): | |
| final_output = "" | |
| for i in range(1, int(count) + 1): | |
| prompt = f""" | |
| Generate ONLY ONE interview question, its answer, and a tip for a candidate. | |
| Job Role: {job_role} | |
| Difficulty: {level} | |
| Format EXACTLY: | |
| Q{i}: | |
| Answer: | |
| Tip: | |
| Do NOT describe yourself or ask the user questions. Only generate interview material. | |
| """ | |
| # Generate text | |
| gen = generator(prompt, max_new_tokens=256, temperature=0.7)[0]["generated_text"] | |
| # Append to final output | |
| final_output += gen.strip() + "\n\n" | |
| return final_output.strip() | |
| # --------- Gradio UI ---------- | |
| with gr.Blocks() 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"], value="Intermediate", label="Difficulty Level") | |
| count = gr.Slider(3, 15, value=5, label="Number of Questions") | |
| btn = gr.Button("Generate") | |
| out = gr.Textbox(lines=25, label="Generated Interview Questions", interactive=True) | |
| btn.click(generate_interview_questions, [job, level, count], out) | |
| demo.launch() | |