layerdiffusion commited on
Commit
6399f3e
1 Parent(s): 6d83c5b
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -168,11 +168,11 @@ def chat_fn(message: str, history: list, seed:int, temperature: float, top_p: fl
168
 
169
  @torch.inference_mode()
170
  def post_chat(history):
171
- history = [(user, assistant) for user, assistant in history if isinstance(user, str) and isinstance(assistant, str)]
172
- last_assistant = history[-1][1]
173
  canvas_outputs = None
174
 
175
  try:
 
 
176
  canvas = omost_canvas.Canvas.from_bot_response(last_assistant)
177
  canvas_outputs = canvas.process()
178
  except Exception as e:
@@ -286,7 +286,7 @@ with gr.Blocks(fill_height=True, css=css) as demo:
286
  undo_btn = gr.Button("↩️ Undo", variant="secondary", size="sm", min_width=60)
287
  clear_btn = gr.Button("⭐️ New Chat", variant="secondary", size="sm", min_width=60)
288
 
289
- seed = gr.Number(label="Random Seed", value=12345, precision=0)
290
 
291
  with gr.Accordion(open=True, label='Language Model'):
292
  with gr.Group():
 
168
 
169
  @torch.inference_mode()
170
  def post_chat(history):
 
 
171
  canvas_outputs = None
172
 
173
  try:
174
+ history = [(user, assistant) for user, assistant in history if isinstance(user, str) and isinstance(assistant, str)]
175
+ last_assistant = history[-1][1] if len(history) > 0 else None
176
  canvas = omost_canvas.Canvas.from_bot_response(last_assistant)
177
  canvas_outputs = canvas.process()
178
  except Exception as e:
 
286
  undo_btn = gr.Button("↩️ Undo", variant="secondary", size="sm", min_width=60)
287
  clear_btn = gr.Button("⭐️ New Chat", variant="secondary", size="sm", min_width=60)
288
 
289
+ seed = gr.Number(label="Random Seed", value=123456, precision=0)
290
 
291
  with gr.Accordion(open=True, label='Language Model'):
292
  with gr.Group():