Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,12 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
3 |
-
from datasets import load_dataset
|
4 |
import torch
|
5 |
|
6 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
7 |
|
8 |
-
SAVED_MODEL_PATH = 'bart_base_full_finetune_save'
|
|
|
9 |
model_name = "facebook/bart-base"
|
10 |
model = AutoModelForSeq2SeqLM.from_pretrained(SAVED_MODEL_PATH).to(device)
|
11 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
@@ -17,7 +18,6 @@ def summarize(text):
|
|
17 |
summary = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=False) for g in summary_ids]
|
18 |
return summary[0]
|
19 |
|
20 |
-
##
|
21 |
iface = gr.Interface(
|
22 |
fn=summarize,
|
23 |
inputs=gr.Textbox(lines=10, label="Input Dialogue"),
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
|
3 |
+
#from datasets import load_dataset
|
4 |
import torch
|
5 |
|
6 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
7 |
|
8 |
+
#SAVED_MODEL_PATH = 'bart_base_full_finetune_save'
|
9 |
+
SAVED_MODEL_PATH = './bart_base_full_finetune_save
|
10 |
model_name = "facebook/bart-base"
|
11 |
model = AutoModelForSeq2SeqLM.from_pretrained(SAVED_MODEL_PATH).to(device)
|
12 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
|
18 |
summary = [tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=False) for g in summary_ids]
|
19 |
return summary[0]
|
20 |
|
|
|
21 |
iface = gr.Interface(
|
22 |
fn=summarize,
|
23 |
inputs=gr.Textbox(lines=10, label="Input Dialogue"),
|