pablocst commited on
Commit
37cecac
·
1 Parent(s): 12efc57

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -120,23 +120,22 @@ with gr.Blocks(css=css) as demo:
120
  gr.HTML(title)
121
  with gr.Column(elem_id="col_container"):
122
  openai_api_key = gr.Textbox(type='password', label="Insira sua chave de API OpenAI aqui")
123
- chatbot = gr.Chatbot(elem_id="chatbot")
124
  inputs = gr.Textbox(placeholder="Olá!", label="Digite uma entrada e pressione Enter", lines=3)
125
  state = gr.State([])
126
  b1 = gr.Button(value="Executar", variant="primary")
127
-
128
- #inputs, top_p, temperature, top_k, repetition_penalty
129
  with gr.Accordion("Parameters", open=False):
130
- top_p = gr.Slider( minimum=-0, maximum=1.0, value=1.0, step=0.05, interactive=True, label="Top-p (nucleus sampling)",)
131
- temperature = gr.Slider( minimum=-0, maximum=5.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
132
- #top_k = gr.Slider( minimum=1, maximum=50, value=4, step=1, interactive=True, label="Top-k",)
133
- #repetition_penalty = gr.Slider( minimum=0.1, maximum=3.0, value=1.03, step=0.01, interactive=True, label="Repetition Penalty", )
134
- chat_counter = gr.Number(value=0, visible=False, precision=0)
135
-
136
- inputs.submit( predict, [inputs, top_p, temperature, openai_api_key, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
137
- b1.click( predict, [inputs, top_p, temperature, openai_api_key, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
138
- b1.click(reset_textbox, [], [inputs])
139
- inputs.submit(reset_textbox, [], [inputs])
140
-
141
- #gr.Markdown(description)
142
  demo.queue().launch(debug=True)
 
120
  gr.HTML(title)
121
  with gr.Column(elem_id="col_container"):
122
  openai_api_key = gr.Textbox(type='password', label="Insira sua chave de API OpenAI aqui")
123
+ chatbot = gr.Chatbot(elem_id="chatbot")
124
  inputs = gr.Textbox(placeholder="Olá!", label="Digite uma entrada e pressione Enter", lines=3)
125
  state = gr.State([])
126
  b1 = gr.Button(value="Executar", variant="primary")
127
+
128
+ # Parâmetros
129
  with gr.Accordion("Parameters", open=False):
130
+ top_p = gr.Slider(minimum=0, maximum=1.0, value=1.0, step=0.05, label="Top-p")
131
+ temperature = gr.Slider(minimum=0, maximum=5.0, value=1.0, step=0.1, label="Temperature")
132
+ chat_counter = gr.Number(value=0, visible=False)
133
+
134
+ # Associando a função 'predict' ao campo de entrada 'inputs' e ao botão 'b1'
135
+ inputs.submit(predict, inputs=[inputs, top_p, temperature, openai_api_key, chat_counter, chatbot, state], outputs=[chatbot, state, chat_counter])
136
+ b1.click(predict, inputs=[inputs, top_p, temperature, openai_api_key, chat_counter, chatbot, state], outputs=[chatbot, state, chat_counter])
137
+
138
+ # Botão para limpar o campo de texto
139
+ b1.click(reset_textbox, inputs=[], outputs=[inputs])
140
+
 
141
  demo.queue().launch(debug=True)