vpcom commited on
Commit
0ee07e8
·
1 Parent(s): 67d6e0f

fix: just use the inputs list and render the item

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -142,14 +142,17 @@ chat_interface = gr.ChatInterface(
142
  cache_examples=False,
143
  )
144
 
145
- def evolve_text(x):
146
- return "".join([x for x in generate(
 
147
  x, "", "<|endoftext|>",
148
  temperature=0.9, max_new_tokens=10,
149
  top_p=0.95, repetition_penalty=1.2,
150
  seed=42,
151
  )][-1]) #TODO: need a smarter way to do this
152
 
 
 
153
  with gr.Blocks(css=CSS) as demo:
154
  with gr.Row():
155
  with gr.Column():
@@ -162,7 +165,7 @@ with gr.Blocks(css=CSS) as demo:
162
  chatbot.like(vote, None, None)
163
 
164
  #output = gr.Textbox(label="What you can expect coming:")
165
- textbox.change(fn=evolve_text, inputs=textbox, outputs=textbox.info,
166
  show_progress = False, status_tracker = None)
167
 
168
  #textbox.render()
 
142
  cache_examples=False,
143
  )
144
 
145
+ def evolve_text(textbox, additional_inputs):
146
+
147
+ possible_generation = "".join([x for x in generate(
148
  x, "", "<|endoftext|>",
149
  temperature=0.9, max_new_tokens=10,
150
  top_p=0.95, repetition_penalty=1.2,
151
  seed=42,
152
  )][-1]) #TODO: need a smarter way to do this
153
 
154
+ textbox.info = possible_generation
155
+
156
  with gr.Blocks(css=CSS) as demo:
157
  with gr.Row():
158
  with gr.Column():
 
165
  chatbot.like(vote, None, None)
166
 
167
  #output = gr.Textbox(label="What you can expect coming:")
168
+ textbox.change(fn=evolve_text, inputs=[textbox, additional_inputs],
169
  show_progress = False, status_tracker = None)
170
 
171
  #textbox.render()