[NT] Use pretrained model for summarization
Browse files- app.py +10 -1
- requirements.txt +2 -0
app.py
CHANGED
@@ -1,7 +1,16 @@
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
def get_summary(text):
|
4 |
-
return
|
5 |
|
6 |
iface = gr.Interface(fn=get_summary, inputs="text", outputs="text")
|
7 |
iface.launch()
|
|
|
1 |
+
__all__ = ['learn', 'get_summary', 'intf']
|
2 |
+
|
3 |
+
from fastai.vision.all import *
|
4 |
import gradio as gr
|
5 |
+
from blurr.text.data.all import *
|
6 |
+
from blurr.text.modeling.all import *
|
7 |
+
|
8 |
+
pre_trained_model_name = "sshleifer/distilbart-cnn-6-6"
|
9 |
+
hf_arch, hf_config, hf_tokenizer, hf_model = BlurrText().get_hf_objects(pre_trained_model_name, model_cls=BartForConditionalGeneration)
|
10 |
+
#learn = load_learner(fname='cnn_model.pkl')
|
11 |
|
12 |
def get_summary(text):
|
13 |
+
return hf_model.blurr_summarize(text)
|
14 |
|
15 |
iface = gr.Interface(fn=get_summary, inputs="text", outputs="text")
|
16 |
iface.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
bert_score
|
2 |
+
ohmeow-blurr
|