un-index commited on
Commit
d21d696
·
1 Parent(s): b83ba99
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -25,14 +25,14 @@ import gradio as gr
25
  temperature = gr.inputs.Slider(
26
  minimum=0, maximum=1.5, default=0.8, label="temperature")
27
  top_p = gr.inputs.Slider(minimum=0, maximum=1.0,
28
- default=0.9, label="top_p")
29
 
30
  # gradio checkbutton
31
 
32
  generator = pipeline('text-generation', model='gpt2')
33
 
34
 
35
- title = "GPT-J-6B"
36
 
37
  examples = [
38
  # another machine learning example
@@ -67,7 +67,7 @@ def f(context, temperature, top_p, max_length, model_idx):
67
  set_seed(randint(1, 2**31))
68
  # return sequences specifies how many to return
69
  json = generator(context, max_length=max_length, top_p=top_p, temperature=temperature, num_return_sequences=1)
70
- return json['generated_text']
71
  # args found in the source: https://github.com/huggingface/transformers/blob/27b3031de2fb8195dec9bc2093e3e70bdb1c4bff/src/transformers/generation_tf_utils.py#L348-L376
72
 
73
  except Exception as e:
 
25
  temperature = gr.inputs.Slider(
26
  minimum=0, maximum=1.5, default=0.8, label="temperature")
27
  top_p = gr.inputs.Slider(minimum=0, maximum=1.0,
28
+ default=0.9, label="top p")
29
 
30
  # gradio checkbutton
31
 
32
  generator = pipeline('text-generation', model='gpt2')
33
 
34
 
35
+ title = "GPT-J-6B/GPT-2 based text generator"
36
 
37
  examples = [
38
  # another machine learning example
 
67
  set_seed(randint(1, 2**31))
68
  # return sequences specifies how many to return
69
  json = generator(context, max_length=max_length, top_p=top_p, temperature=temperature, num_return_sequences=1)
70
+ return type(json)+json#json['generated_text']
71
  # args found in the source: https://github.com/huggingface/transformers/blob/27b3031de2fb8195dec9bc2093e3e70bdb1c4bff/src/transformers/generation_tf_utils.py#L348-L376
72
 
73
  except Exception as e: