un-index commited on
Commit
e9b9296
·
1 Parent(s): 552084d
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -50,9 +50,8 @@ examples = [
50
  [["In a shocking discovery, scientists have found a herd of unicorns living in a remote, previously unexplored valley, in the Andes Mountains. Even more surprising to the researchers was the fact that the unicorns spoke perfect English."], 0.8, 0.9, 50, "GPT-2"],
51
  [["The first step in the process of developing a new language is to invent a new word."], 0.8, 0.9, 50, "GPT-2"],
52
  ]
53
- # # # could easily use the inference API in /gptinference.py but don't know if it supports length>250
54
- # set_seed(randint(1, 2**31))
55
- # args found in the source: https://github.com/huggingface/transformers/blob/27b3031de2fb8195dec9bc2093e3e70bdb1c4bff/src/transformers/generation_tf_utils.py#L348-L376
56
 
57
 
58
  # check if api.vicgalle.net:5000/generate is down with timeout of 10 seconds
@@ -128,7 +127,7 @@ def f(context, temperature, top_p, max_length, model_idx):
128
  #
129
  set_seed(randint(1, 2**31))
130
  # return sequences specifies how many to return
131
- return generator(context, max_length=max_length, top_p=top_p, temperature=temperature, num_return_sequences=1)[0]['generated-text']
132
  # args found in the source: https://github.com/huggingface/transformers/blob/27b3031de2fb8195dec9bc2093e3e70bdb1c4bff/src/transformers/generation_tf_utils.py#L348-L376
133
 
134
  except Exception as e:
 
50
  [["In a shocking discovery, scientists have found a herd of unicorns living in a remote, previously unexplored valley, in the Andes Mountains. Even more surprising to the researchers was the fact that the unicorns spoke perfect English."], 0.8, 0.9, 50, "GPT-2"],
51
  [["The first step in the process of developing a new language is to invent a new word."], 0.8, 0.9, 50, "GPT-2"],
52
  ]
53
+
54
+
 
55
 
56
 
57
  # check if api.vicgalle.net:5000/generate is down with timeout of 10 seconds
 
127
  #
128
  set_seed(randint(1, 2**31))
129
  # return sequences specifies how many to return
130
+ return generator(context, max_length=max_length, top_p=top_p, temperature=temperature, num_return_sequences=1)#[0]['generated-text']
131
  # args found in the source: https://github.com/huggingface/transformers/blob/27b3031de2fb8195dec9bc2093e3e70bdb1c4bff/src/transformers/generation_tf_utils.py#L348-L376
132
 
133
  except Exception as e: