artificialguybr commited on
Commit
2c5ba3b
·
verified ·
1 Parent(s): 111c64a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -86,7 +86,7 @@ with gr.Blocks() as demo:
86
  <p> <strong>Discover more:</strong> <a href="https://artificialguy.com">artificialguy.com</a></p>
87
  """
88
  gr.Markdown(description)
89
- message = gr.Textbox(label="What do you want to chat about?", placeholder="Ask me anything.", lines=3)
90
  chatbot = gr.ChatInterface(
91
  fn=chat,
92
  title="LLAMA 2 70B Chatbot",
@@ -95,7 +95,7 @@ with gr.Blocks() as demo:
95
  retry_btn="🔄 Retry",
96
  undo_btn="↩️ Undo",
97
  clear_btn="🗑️ Clear",
98
- textbox=message # Passar o componente Textbox como parâmetro
99
  )
100
  system_msg = gr.Textbox(BASE_SYSTEM_MESSAGE, label="System Message", placeholder="System prompt.", lines=5)
101
  max_tokens = gr.Slider(20, 1024, label="Max Tokens", step=20, value=1024, interactive=True)
@@ -121,14 +121,14 @@ with gr.Blocks() as demo:
121
 
122
  chatbot.submit(
123
  fn=update_chatbot,
124
- inputs=[message, chat_history_state, system_msg, max_tokens, temperature, top_p],
125
  outputs=chat_history_state
126
  )
127
 
128
  chatbot.clear(
129
  fn=clear_chat,
130
- inputs=[chat_history_state, message],
131
- outputs=[chat_history_state, message]
132
  )
133
 
134
  demo.launch()
 
86
  <p> <strong>Discover more:</strong> <a href="https://artificialguy.com">artificialguy.com</a></p>
87
  """
88
  gr.Markdown(description)
89
+ chatbox = gr.Textbox(label="What do you want to chat about?", placeholder="Ask me anything.", lines=3)
90
  chatbot = gr.ChatInterface(
91
  fn=chat,
92
  title="LLAMA 2 70B Chatbot",
 
95
  retry_btn="🔄 Retry",
96
  undo_btn="↩️ Undo",
97
  clear_btn="🗑️ Clear",
98
+ textbox=chatbox # Usar um novo componente Textbox
99
  )
100
  system_msg = gr.Textbox(BASE_SYSTEM_MESSAGE, label="System Message", placeholder="System prompt.", lines=5)
101
  max_tokens = gr.Slider(20, 1024, label="Max Tokens", step=20, value=1024, interactive=True)
 
121
 
122
  chatbot.submit(
123
  fn=update_chatbot,
124
+ inputs=[chatbox, chat_history_state, system_msg, max_tokens, temperature, top_p],
125
  outputs=chat_history_state
126
  )
127
 
128
  chatbot.clear(
129
  fn=clear_chat,
130
+ inputs=[chat_history_state, chatbox],
131
+ outputs=[chat_history_state, chatbox]
132
  )
133
 
134
  demo.launch()