Staticaliza commited on
Commit
f23f1ad
1 Parent(s): d03ac46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -15,7 +15,7 @@ model._is_chat_session_activated = False
15
 
16
  max_new_tokens = 2048
17
 
18
- def generater(input, instruction, history, temperature, top_p, top_k, rep_p, max_tokens):
19
 
20
  history = history or []
21
  formatted_input = "<s>"
@@ -45,13 +45,17 @@ def generater(input, instruction, history, temperature, top_p, top_k, rep_p, max
45
 
46
  return (result, input, history)
47
 
 
 
 
 
48
  with gr.Blocks() as demo:
49
  with gr.Row(variant = "panel"):
50
  gr.Markdown("A AI model test demo.")
51
 
52
  with gr.Row():
53
  with gr.Column():
54
- history = gr.Chatbot(abel = "History", elem_id = "chatbot")
55
  input = gr.Textbox(label = "Input", value = "", lines = 2)
56
  instruction = gr.Textbox(label = "Instruction", value = "You are an AI chatbot.", lines = 4)
57
  run = gr.Button("▶")
 
15
 
16
  max_new_tokens = 2048
17
 
18
+ def predict(input, instruction, history, temperature, top_p, top_k, rep_p, max_tokens):
19
 
20
  history = history or []
21
  formatted_input = "<s>"
 
45
 
46
  return (result, input, history)
47
 
48
+ def clear_history():
49
+ print(">>> HISTORY CLEARED!")
50
+ return []
51
+
52
  with gr.Blocks() as demo:
53
  with gr.Row(variant = "panel"):
54
  gr.Markdown("A AI model test demo.")
55
 
56
  with gr.Row():
57
  with gr.Column():
58
+ history = gr.Chatbot(label = "History", elem_id = "chatbot")
59
  input = gr.Textbox(label = "Input", value = "", lines = 2)
60
  instruction = gr.Textbox(label = "Instruction", value = "You are an AI chatbot.", lines = 4)
61
  run = gr.Button("▶")