un-index commited on
Commit
eabeaac
·
1 Parent(s): f5f0157
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -100,7 +100,7 @@ def f(context, temperature, top_p, max_length, model_idx, SPACE_VERIFICATION_KEY
100
 
101
  # maybe try "0" instead or 1, or "1"
102
  # use GPT-J-6B
103
- if model_idx == 1:
104
  if main_gpt_j_api_up:
105
  # for this api, a length of > 250 instantly errors, so use a while loop or something
106
  # that would fetch results in chunks of 250
@@ -154,7 +154,7 @@ def f(context, temperature, top_p, max_length, model_idx, SPACE_VERIFICATION_KEY
154
  response = requests.post(
155
  "http://api.vicgalle.net:5000/generate", params=payload).json()
156
  return response['text']
157
- elif model_idx == 0:
158
  # use GPT-2
159
  #
160
  try:
@@ -246,7 +246,7 @@ iface = gr.Interface(f, [
246
  top_p,
247
  gr.inputs.Slider(
248
  minimum=20, maximum=512, default=30, label="max length"),
249
- gr.inputs.Dropdown([ "GPT2","GPT-J-6B", "DistilGPT2", "GPT-Large", "GPT-Neo-2.7B"], type="index", label="model"),
250
  gr.inputs.Textbox(lines=1, placeholder="xxxxxxxx", label="space verification key")
251
 
252
  ], outputs="text", title=title, examples=examples, enable_queue = True) # deprecated iwthin iface.launch: https://discuss.huggingface.co/t/is-there-a-timeout-max-runtime-for-spaces/12979/3?u=un-index
 
100
 
101
  # maybe try "0" instead or 1, or "1"
102
  # use GPT-J-6B
103
+ if model_idx == 0:
104
  if main_gpt_j_api_up:
105
  # for this api, a length of > 250 instantly errors, so use a while loop or something
106
  # that would fetch results in chunks of 250
 
154
  response = requests.post(
155
  "http://api.vicgalle.net:5000/generate", params=payload).json()
156
  return response['text']
157
+ elif model_idx == 1:
158
  # use GPT-2
159
  #
160
  try:
 
246
  top_p,
247
  gr.inputs.Slider(
248
  minimum=20, maximum=512, default=30, label="max length"),
249
+ gr.inputs.Dropdown(["GPT-J-6B", "GPT2", "DistilGPT2", "GPT-Large", "GPT-Neo-2.7B"], type="index", label="model", default="GPT2"),
250
  gr.inputs.Textbox(lines=1, placeholder="xxxxxxxx", label="space verification key")
251
 
252
  ], outputs="text", title=title, examples=examples, enable_queue = True) # deprecated iwthin iface.launch: https://discuss.huggingface.co/t/is-there-a-timeout-max-runtime-for-spaces/12979/3?u=un-index