Sigurdur's picture
Create app.py
a7c67de verified
raw
history blame
685 Bytes
import gradio as gr
from transformers import AutoModel, AutoTokenizer
from transformers import TextGenerationPipeline
tokenizer = AutoTokenizer.from_pretrained("Sigurdur/icebreaker")
model = AutoModel.from_pretrained("Sigurdur/icebreaker")
pipeline = TextGenerationPipeline(model=model, tokenizer=tokenizer)
def generate_text(inp):
generated_text = pipeline(inp)
output = generated_text[0]["generated_text"]
return output
output_text = gr.outputs.Textbox()
gr.Interface(generate_text,"textbox",output_text,title="Text Generation machine ",description="Ask any question. Note: It can take 20-60 seconds to generate output based on your internet connection.").launch()