zmbfeng commited on
Commit
cde20ed
·
verified ·
1 Parent(s): 0ebfc8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -1,6 +1,8 @@
1
  import gradio as gr
2
  import random
3
  import os
 
 
4
  from huggingface_hub import login
5
  from transformers import pipeline
6
  from transformers import GPT2Tokenizer, GPT2LMHeadModel
@@ -95,8 +97,8 @@ common_examples=[
95
  ["One of the best teachers in all of life turns out to be what?",5,0.2,1.5,0.9,True], # The second example
96
  ["what is your most meaningful relationship?",5,0.2,1.5,0.9,True], # The third example
97
  ["What actually gives life meaning?",5,0.2,1.5,0.9,True]
98
- ],
99
- examples = common_examples.copy()
100
  for example in examples:
101
  example.append("original_model")
102
 
@@ -107,7 +109,7 @@ interface_original = gr.Interface(fn=create_response,
107
  inputs=common_input_component_list.append(gr.Textbox(label="model", lines=3, value="original_model",visible=False)),
108
  outputs=common_output_component_list
109
  )
110
- examples = common_examples.copy()
111
  for example in examples:
112
  example.append("untethered_model")
113
  interface_untethered_model = gr.Interface(fn=create_response,
@@ -118,7 +120,7 @@ interface_untethered_model = gr.Interface(fn=create_response,
118
  outputs=common_output_component_list
119
  )
120
 
121
- examples = common_examples.copy()
122
  for example in examples:
123
  example.append("untethered_paraphrased_model")
124
  interface_untethered_model = gr.Interface(fn=create_response,
 
1
  import gradio as gr
2
  import random
3
  import os
4
+ import copy
5
+
6
  from huggingface_hub import login
7
  from transformers import pipeline
8
  from transformers import GPT2Tokenizer, GPT2LMHeadModel
 
97
  ["One of the best teachers in all of life turns out to be what?",5,0.2,1.5,0.9,True], # The second example
98
  ["what is your most meaningful relationship?",5,0.2,1.5,0.9,True], # The third example
99
  ["What actually gives life meaning?",5,0.2,1.5,0.9,True]
100
+ ]
101
+ examples = copy.deepcopy(common_examples)
102
  for example in examples:
103
  example.append("original_model")
104
 
 
109
  inputs=common_input_component_list.append(gr.Textbox(label="model", lines=3, value="original_model",visible=False)),
110
  outputs=common_output_component_list
111
  )
112
+ examples = copy.deepcopy(common_examples)
113
  for example in examples:
114
  example.append("untethered_model")
115
  interface_untethered_model = gr.Interface(fn=create_response,
 
120
  outputs=common_output_component_list
121
  )
122
 
123
+ examples = copy.deepcopy(common_examples)
124
  for example in examples:
125
  example.append("untethered_paraphrased_model")
126
  interface_untethered_model = gr.Interface(fn=create_response,