Spaces:
Build error
Build error
Download app.py from DutchNomadCode/testing-pipeline: direct link, hf CLI and curl.
- Browser
- Download file 514 Bytes
-
https://huggingface.co/spaces/DutchNomadCode/testing-pipeline/resolve/main/app.py
- Command line
-
hf download hf://spaces/DutchNomadCode/testing-pipeline/app.py
-
curl -L -o app.py https://huggingface.co/spaces/DutchNomadCode/testing-pipeline/resolve/main/app.py
514 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| def text_gen(input): | |
| generator = pipeline("text-generation", model="distilgpt2") | |
| generated_text = generator(input)[0]['generated_text'] | |
| # Split the generated text into sentences and concatenate them | |
| sentences = generated_text.split('.') | |
| full_sentence = ' '.join(sentence.strip() for sentence in sentences if sentence.strip()) | |
| return f"'{full_sentence}'" | |
| iface = gr.Interface(fn=text_gen, inputs="text", outputs="text") | |
| iface.launch() | |