Najish Mahmud commited on
Commit
05038f8
1 Parent(s): 9a21621

added deps

Browse files
Files changed (3) hide show
  1. .gitignore +1 -0
  2. app.py +16 -1
  3. requirements.txt +2 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .venv
app.py CHANGED
@@ -1,3 +1,18 @@
1
  import gradio as gr
2
 
3
- gr.Interface.load("models/Afsara/fb_bart_large_cnn").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
4
+ from normalizer import normalize # pip install git+https://github.com/csebuetnlp/normalizer
5
+
6
+ def summarize(text):
7
+ model = AutoModelForSeq2SeqLM.from_pretrained("csebuetnlp/banglat5")
8
+ tokenizer = AutoTokenizer.from_pretrained("csebuetnlp/banglat5", use_fast=False)
9
+
10
+ input_ids = tokenizer(normalize(text), return_tensors="pt").input_ids
11
+ generated_tokens = model.generate(input_ids)
12
+ decoded_tokens = tokenizer.batch_decode(generated_tokens)[0]
13
+ return decoded_tokens
14
+
15
+
16
+ gr_interface = gr.Interface("models/Afsara/fb_bart_large_cnn")
17
+
18
+ gr_interface.launch()
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ transformers==4.29.2
2
+ normalizer==0.2.1