CoolFace
Apppublic

Datadote/test

sourceHugging Faceupdated 4y agoView on Hugging Face
0likes
app.py26 linesDownload Raw Back to root
1from transformers import pipeline2import gradio as gr3 4model = pipeline("text-generation")5 6def predict(prompt):7    # In Gradio, can't put model prediction directly in return statement8    gen_text = model(prompt, max_length=24)[0]['generated_text']9    return gen_text10 11title = 'Finish The Prompt'12description = """13Use triple quotes for long descriptions14Like this15"""16examples=[['I am starting to'], ['Next time, I am going to']]17 18demo = gr.Interface(19    fn=predict,20    inputs='text',21    outputs='text',22    title=title,23    description=description,24    article='Expanded article explaining the interface',25    examples=examples26).launch()