sepidpy commited on
Commit
aaa2226
1 Parent(s): ca299de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -1,12 +1,16 @@
1
- import gradio as gr
2
  from transformers import pipeline
 
 
3
 
4
- model= pipeline("summarization")
 
 
5
 
6
- def predict(promt):
7
- summary=model(prompt)[0]["summary_text"]
8
  return summary
9
- with gr.Blocks() as demo:
10
- textbox=gr.TextBox(placeholder="enter text to summarize",lines=4)
11
- gr.Interface(fn=predict,inputs=textbox,outputs="text")
12
- demo.launch()
 
 
 
1
  from transformers import pipeline
2
+ import gradio as gr
3
+
4
 
5
+ model = pipeline(
6
+ "summarization",
7
+ )
8
 
9
+ def predict(prompt):
10
+ summary = model(prompt)[0]["summary_text"]
11
  return summary
12
+
13
+
14
+ # create an interface for the model
15
+ with gr.Interface(predict, "textbox", "text") as interface:
16
+ interface.launch()