Grey01 commited on
Commit
450bde5
·
verified ·
1 Parent(s): 2c79d1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
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('Grey01/bart_billsum')
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
- decoder_sequence_length=128,)
 
16
 
17
- return model, preprocessor
18
 
19
- model, preprocessor = load_model_and_preprocessor()
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