K00B404 commited on
Commit
0fdef8a
·
verified ·
1 Parent(s): e954657

Rename app2.py to app.py

Browse files
Files changed (2) hide show
  1. app.py +25 -0
  2. app2.py +0 -3
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ !pip install gradio[notebook]
3
+ import gradio as gr
4
+
5
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
6
+
7
+
8
+ tokenizer = AutoTokenizer.from_pretrained("t5-base")
9
+ model = AutoModelForSeq2seqLM.from_pretrained("t5-base")
10
+
11
+ def predict(input_text):
12
+ inputs = tokenizer(input_text, return_tensors="pt")
13
+ outputs = model.generate(**inputs)
14
+ decoded_prediction = tokenizer.decode(outputs[0], skip_special_tokens=True)
15
+ return decoded_prediction
16
+
17
+ iface = gr.Interface(fn=predict,
18
+ inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your text..."),
19
+ outputs="text",
20
+ title="My Text Summarization App",
21
+ description="Summarize large blocks of text.",
22
+ theme="default",
23
+ analytics_enabled=False)
24
+
25
+ iface.launch()
app2.py DELETED
@@ -1,3 +0,0 @@
1
- import gradio as gr
2
-
3
- gr.Interface.load("huggingface/facebook/blenderbot-400M-distill").launch()