Spaces:
Sleeping
Sleeping
Download app.py from sekuxrious/FastAPI: direct link, hf CLI and curl.
- Browser
- Download file 742 Bytes
-
https://huggingface.co/spaces/sekuxrious/FastAPI/resolve/40d2e8c8be6cb27cf19b930ed2695d3fca6072a4/app.py
- Command line
-
hf download hf://spaces/sekuxrious/FastAPI@40d2e8c8be6cb27cf19b930ed2695d3fca6072a4/app.py
-
curl -L -o app.py https://huggingface.co/spaces/sekuxrious/FastAPI/resolve/40d2e8c8be6cb27cf19b930ed2695d3fca6072a4/app.py
742 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| generator = pipeline( | |
| "text-generation", | |
| model="distilgpt2", | |
| pad_token_id=50256 # DistilGPT2 uses the same special tokens as GPT2 | |
| ) | |
| def generate_cv(name, education, experience): | |
| prompt = ( | |
| f"Generate a CV:\n" | |
| f"Name: {name}\n" | |
| f"Education: {education}\n" | |
| f"Experience: {experience}\n" | |
| "CV:\n" | |
| ) | |
| outputs = generator( | |
| prompt, | |
| max_new_tokens=50, | |
| do_sample=True, | |
| top_k=50, | |
| temperature=0.7 | |
| ) | |
| return outputs[0]["generated_text"] | |
| demo = gr.Interface( | |
| fn=generate_cv, | |
| inputs=["text", "text", "text"], | |
| outputs="text", | |
| title="Automated CV Generator" | |
| ) | |
| demo.launch() |