Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,14 +1,16 @@
|
|
1 |
import torch
|
2 |
-
|
3 |
from fastai.text.all import *
|
4 |
-
from
|
5 |
-
from
|
6 |
-
from transformers import BartForConditionalGeneration
|
7 |
|
8 |
# Load the pre-trained model and tokenizer (adjust for Bart if needed)
|
9 |
pretrained_model_name = "facebook/bart-large-cnn" # Or "facebook/bart-base"
|
10 |
hf_tokenizer = BartTokenizer.from_pretrained(pretrained_model_name)
|
11 |
|
|
|
|
|
|
|
12 |
def summarize(article):
|
13 |
# Define your data transformation pipeline here, if applicable
|
14 |
# ...
|
|
|
1 |
import torch
|
2 |
+
import gradio as gr
|
3 |
from fastai.text.all import *
|
4 |
+
from transformers import BartTokenizer
|
5 |
+
from datasets import load_metric
|
|
|
6 |
|
7 |
# Load the pre-trained model and tokenizer (adjust for Bart if needed)
|
8 |
pretrained_model_name = "facebook/bart-large-cnn" # Or "facebook/bart-base"
|
9 |
hf_tokenizer = BartTokenizer.from_pretrained(pretrained_model_name)
|
10 |
|
11 |
+
# Load the SQuAD metric
|
12 |
+
squad_metric = load_metric("squad")
|
13 |
+
|
14 |
def summarize(article):
|
15 |
# Define your data transformation pipeline here, if applicable
|
16 |
# ...
|