Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,14 @@
|
|
1 |
import streamlit as st
|
2 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
3 |
import torch
|
4 |
-
import gdown
|
5 |
import os
|
6 |
|
7 |
-
#
|
8 |
-
|
9 |
-
def download_and_load_model():
|
10 |
-
url = 'https://drive.google.com/uc?id=YOUR_FILE_ID' # Replace with your actual file ID
|
11 |
-
output = 'T5_samsum.zip'
|
12 |
-
model_path = './T5_samsum'
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
model = T5ForConditionalGeneration.from_pretrained(model_path)
|
19 |
-
tokenizer = T5Tokenizer.from_pretrained(model_path)
|
20 |
-
return model, tokenizer
|
21 |
-
|
22 |
-
model, tokenizer = download_and_load_model()
|
23 |
|
24 |
st.title("T5 Summarization")
|
25 |
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import T5Tokenizer, T5ForConditionalGeneration
|
3 |
import torch
|
|
|
4 |
import os
|
5 |
|
6 |
+
# Path to the folder containing the saved model
|
7 |
+
model_path = './T5_samsum'
|
|
|
|
|
|
|
|
|
8 |
|
9 |
+
# Ensure the model and tokenizer are loaded from the specified folder
|
10 |
+
model = T5ForConditionalGeneration.from_pretrained(model_path)
|
11 |
+
tokenizer = T5Tokenizer.from_pretrained(model_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
st.title("T5 Summarization")
|
14 |
|