RickMartel commited on
Commit
3baff9f
1 Parent(s): d1fe01d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -1,13 +1,24 @@
1
  import streamlit as st
2
- from transformers import pipeline
 
 
 
 
 
 
 
 
3
 
4
  pipe = pipeline(
5
- "text-generation", model="RickMartel/GPT2_FT_By_NT_RAND_v5", device="cpu"
 
 
 
6
  )
7
 
8
  st.set_page_config(page_title="GPT2 4 Bible")
9
 
10
- txt = st.text_area('Enter prompt of a biblical nature. WARNING: results will not be exact.')
11
 
12
  if txt and len(txt.strip()) > 0:
13
  txt = "<|startoftext|>" + txt
 
1
  import streamlit as st
2
+ from transformers import pipeline, PretrainedConfig
3
+
4
+
5
+ pc = PretrainedConfig(
6
+ max_new_tokens=100,
7
+ num_beams=5,
8
+ early_stopping=True,
9
+ no_repeat_ngram_size=2,
10
+ )
11
 
12
  pipe = pipeline(
13
+ "text-generation",
14
+ model="RickMartel/GPT2_FT_By_NT_RAND_v5",
15
+ device="cpu",
16
+ config=pc
17
  )
18
 
19
  st.set_page_config(page_title="GPT2 4 Bible")
20
 
21
+ txt = st.text_area('Enter prompt of a biblical nature. WARNING: Results may not be correct.')
22
 
23
  if txt and len(txt.strip()) > 0:
24
  txt = "<|startoftext|>" + txt