BigSalmon commited on
Commit
d18493e
1 Parent(s): 9bc5128

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -9,7 +9,24 @@ from transformers import AutoTokenizer, AutoModelForCausalLM
9
  import tokenizers
10
  #os.environ["TOKENIZERS_PARALLELISM"] = "false"
11
  random.seed(None)
12
- suggested_text_list = ['驻注诐 讗讞转, 诇驻谞讬 砖谞讬诐 专讘讜转','砖诇讜诐, 拽讜专讗讬诐 诇讬 讚讜专讜谉 讜讗谞讬','讘讜拽专 讟讜讘 诇讻讜诇诐','讜讗讝 讛驻专转讬 讗转 讻诇 讻诇诇讬 讛讟拽住 讻砖']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  @st.cache(hash_funcs={tokenizers.Tokenizer: id, tokenizers.AddedToken: id})
14
  def load_model(model_name):
15
  tokenizer = AutoTokenizer.from_pretrained(model_name)
@@ -45,6 +62,8 @@ def extend(input_text, num_return_sequences, max_size=20, top_k=50, top_p=0.95):
45
  total_sequence = (
46
  input_text + text[len(tokenizer.decode(encoded_prompt[0], clean_up_tokenization_spaces=True)) :]
47
  )
 
 
48
  #generated_sequences.append(total_sequence)
49
  generated_sequences.append(text)
50
  st.write(text)
 
9
  import tokenizers
10
  #os.environ["TOKENIZERS_PARALLELISM"] = "false"
11
  random.seed(None)
12
+ first = """
13
+ informal english: garage band has made people who know nothing about music good at creating music.
14
+ Translated into the Style of Abraham Lincoln: garage band ( offers the uninitiated in music the ability to produce professional-quality compositions / catapults those for whom music is an uncharted art the ability the realize masterpieces / stimulates music novice's competency to yield sublime arrangements / begets individuals of rudimentary musical talent the proficiency to fashion elaborate suites ).
15
+
16
+ informal english: chrome extensions can make doing regular tasks much easier to get done.
17
+ Translated into the Style of Abraham Lincoln: chrome extensions ( yield the boon of time-saving convenience / ( expedite the ability to / unlock the means to more readily ) accomplish everyday tasks / turbocharges the velocity with which one can conduct their obligations ).
18
+
19
+ informal english: broadband is finally expanding to rural areas, a great development that will thrust them into modern life.
20
+ Translated into the Style of Abraham Lincoln: broadband is ( ( finally / at last / after years of delay ) arriving in remote locations / springing to life in far-flung outposts / inching into even the most backwater corners of the nation ) that will leap-frog them into the twenty-first century.
21
+
22
+ informal english: google translate has made talking to people who do not share your language easier.
23
+ Translated into the Style of Abraham Lincoln: google translate ( imparts communicability to individuals whose native tongue differs / mitigates the trials of communication across linguistic barriers / hastens the bridging of semantic boundaries / mollifies the complexity of multilingual communication / avails itself to the internationalization of discussion / flexes its muscles to abet intercultural conversation / calms the tides of linguistic divergence ).
24
+
25
+ informal english: corn fields are all across illinois, visible once you leave chicago.
26
+ Translated into the Style of Abraham Lincoln: corn fields ( permeate illinois / span the state of illinois / ( occupy / persist in ) all corners of illinois / line the horizon of illinois / envelop the landscape of illinois ), manifesting themselves visibly as one ventures beyond chicago.
27
+
28
+ informal english:"""
29
+ suggested_text_list = [first]
30
  @st.cache(hash_funcs={tokenizers.Tokenizer: id, tokenizers.AddedToken: id})
31
  def load_model(model_name):
32
  tokenizer = AutoTokenizer.from_pretrained(model_name)
 
62
  total_sequence = (
63
  input_text + text[len(tokenizer.decode(encoded_prompt[0], clean_up_tokenization_spaces=True)) :]
64
  )
65
+ print(total_sequence)
66
+
67
  #generated_sequences.append(total_sequence)
68
  generated_sequences.append(text)
69
  st.write(text)