artificialguybr commited on
Commit
cdf0c60
·
verified ·
1 Parent(s): 5901f4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -77,10 +77,17 @@ max_tokens = gr.Slider(20, 1024, label="Max Tokens", step=20, value=1024)
77
  temperature = gr.Slider(0.0, 1.0, label="Temperature", step=0.1, value=0.2)
78
  top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.7)
79
 
 
 
 
 
 
 
 
80
  with gr.Blocks() as demo:
81
  chat_history_state = gr.State([])
82
  chatbot = gr.ChatInterface(
83
- fn=update_chatbot,
84
  additional_inputs=[chat_history_state, system_msg, max_tokens, temperature, top_p],
85
  title="LLAMA 70B Free Demo",
86
  description="""
@@ -107,5 +114,4 @@ with gr.Blocks() as demo:
107
  chatbot.textbox.value = ""
108
 
109
  chatbot.clear()
110
-
111
  demo.launch()
 
77
  temperature = gr.Slider(0.0, 1.0, label="Temperature", step=0.1, value=0.2)
78
  top_p = gr.Slider(0.0, 1.0, label="Top P", step=0.05, value=0.7)
79
 
80
+ def chatbot_submit(message, chat_history, system_message, max_tokens_val, temperature_val, top_p_val):
81
+ """Submits the user message to the chatbot and updates the chat history."""
82
+ if chat_history is None:
83
+ chat_history = []
84
+ chat_history = update_chatbot(message, chat_history)
85
+ return chat_history
86
+
87
  with gr.Blocks() as demo:
88
  chat_history_state = gr.State([])
89
  chatbot = gr.ChatInterface(
90
+ fn=chatbot_submit,
91
  additional_inputs=[chat_history_state, system_msg, max_tokens, temperature, top_p],
92
  title="LLAMA 70B Free Demo",
93
  description="""
 
114
  chatbot.textbox.value = ""
115
 
116
  chatbot.clear()
 
117
  demo.launch()