Luis Oala
Update app.py
0cedc3a
#TODO: integrate into markdown
#TODO: clean up output formatting
import gradio as gr
from gradio import mix
from transformers import pipeline, set_seed
generator = pipeline('text-generation', model='gpt2')
def inference(text, seed):
set_seed(int(seed))
outtext = generator(text, max_length=100, num_return_sequences=1) #get the string from the return dict with key 'generated text'
return outtext
gr.Interface(
inference,
[gr.inputs.Radio(choices=["trustworthy artificial intelligence"], label="input"), gr.inputs.Slider(minimum=0., maximum=1000.,label="seed")],
gr.outputs.Textbox(label="gpt-2 proposal"),
cache_examples=True,
allow_flagging="manual").launch(enable_queue=True)
#TODO: add credits at bottom