Sigurdur commited on
Commit
0e54e9e
·
verified ·
1 Parent(s): 4f797e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -15
app.py CHANGED
@@ -1,18 +1,7 @@
 
1
  import gradio as gr
2
 
3
- from transformers import AutoModelForCausalLM, AutoTokenizer
4
- from transformers import TextGenerationPipeline
5
 
6
-
7
- tokenizer = AutoTokenizer.from_pretrained("Sigurdur/icebreaker")
8
- model = AutoModelForCausalLM.from_pretrained("Sigurdur/icebreaker")
9
- pipeline = TextGenerationPipeline(model=model, tokenizer=tokenizer)
10
-
11
- def generate_text(inp):
12
- generated_text = pipeline(inp)
13
-
14
- output = generated_text[0]["generated_text"]
15
- return output
16
-
17
- output_text = gr.outputs.Textbox()
18
- 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()
 
1
+ from transformers import pipeline
2
  import gradio as gr
3
 
4
+ pipe = pipeline("text-generation", model="Sigurdur/icebreaker")
 
5
 
6
+ demo = gr.Interface.from_pipeline(pipe)
7
+ demo.launch()