Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,18 +5,22 @@ import keras_nlp
|
|
5 |
import PyPDF2
|
6 |
import docx2txt
|
7 |
|
|
|
|
|
|
|
8 |
# Load your Keras model
|
9 |
@st.cache_resource
|
10 |
def load_model_and_preprocessor():
|
11 |
-
bart_billsum = keras_nlp.models.BartSeq2SeqLM.from_preset('
|
12 |
|
13 |
# Load the default BART preprocessor (assuming you saved its configuration)
|
14 |
-
preprocessor = keras_nlp.models.BartSeq2SeqLMPreprocessor.from_preset('bart_base_en', encoder_sequence_length=512,
|
15 |
-
|
|
|
16 |
|
17 |
-
return model
|
18 |
|
19 |
-
model
|
20 |
|
21 |
st.title("SummarizeIt")
|
22 |
|
|
|
5 |
import PyPDF2
|
6 |
import docx2txt
|
7 |
|
8 |
+
hf_username = huggingface_hub.whoami()['name']
|
9 |
+
hf_url = f'hf://{hf_username}/bart_billsum'
|
10 |
+
|
11 |
# Load your Keras model
|
12 |
@st.cache_resource
|
13 |
def load_model_and_preprocessor():
|
14 |
+
bart_billsum = keras_nlp.models.BartSeq2SeqLM.from_preset(f'hf://{hf_username}/bart_billsum')
|
15 |
|
16 |
# Load the default BART preprocessor (assuming you saved its configuration)
|
17 |
+
#preprocessor = keras_nlp.models.BartSeq2SeqLMPreprocessor.from_preset('bart_base_en', encoder_sequence_length=512,
|
18 |
+
|
19 |
+
#decoder_sequence_length=128,)
|
20 |
|
21 |
+
return model
|
22 |
|
23 |
+
model = load_model_and_preprocessor()
|
24 |
|
25 |
st.title("SummarizeIt")
|
26 |
|