Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
model =
|
7 |
-
|
8 |
def summarize(text):
|
9 |
inputs = tokenizer(text, return_tensors="pt", truncation=True)
|
10 |
summary_ids = model.generate(inputs.input_ids, max_length=512, min_length=64, length_penalty=2.0, num_beams=4, early_stopping=True)
|
|
|
1 |
import gradio as gr
|
2 |
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
3 |
+
from peft import PeftModel, PeftConfig
|
4 |
|
5 |
+
config = PeftConfig.from_pretrained("zeyadusf/FlanT5Summarization-samsum")
|
6 |
+
base_model = AutoModelForSeq2SeqLM.from_pretrained("google/flan-t5-large")
|
7 |
+
model = PeftModel.from_pretrained(base_model, "zeyadusf/FlanT5Summarization-samsum")
|
|
|
8 |
def summarize(text):
|
9 |
inputs = tokenizer(text, return_tensors="pt", truncation=True)
|
10 |
summary_ids = model.generate(inputs.input_ids, max_length=512, min_length=64, length_penalty=2.0, num_beams=4, early_stopping=True)
|