pablocst commited on
Commit
9f75c50
1 Parent(s): e3b1682

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -14
app.py CHANGED
@@ -112,24 +112,26 @@ css = """
112
 
113
  with gr.Blocks(css=css) as demo:
114
  gr.HTML(title)
 
115
  with gr.Column(elem_id="col_container"):
116
  openai_api_key = gr.Textbox(type='password', label="Insira sua chave de API OpenAI aqui")
117
- chatbot = gr.Chatbot(elem_id="chatbot")
118
  inputs = gr.Textbox(placeholder="Olá!", label="Digite uma entrada e pressione Enter", lines=3)
119
  state = gr.State([])
120
  b1 = gr.Button(value="Executar", variant="primary")
121
-
122
- # Parâmetros
123
  with gr.Accordion("Parameters", open=False):
124
- top_p = gr.Slider(minimum=0, maximum=1.0, value=1.0, step=0.05, label="Top-p")
125
- temperature = gr.Slider(minimum=0, maximum=5.0, value=1.0, step=0.1, label="Temperature")
126
- chat_counter = gr.Number(value=0, visible=False)
127
-
128
- # Associando a função 'predict' ao campo de entrada 'inputs' e ao botão 'b1'
129
- inputs.submit(predict, inputs=[inputs, top_p, temperature, openai_api_key, chat_counter, chatbot, state], outputs=[chatbot, state, chat_counter])
130
- b1.click(predict, inputs=[inputs, top_p, temperature, openai_api_key, chat_counter, chatbot, state], outputs=[chatbot, state, chat_counter])
131
-
132
- # Botão para limpar o campo de texto
133
- b1.click(reset_textbox, inputs=[], outputs=[inputs])
134
-
 
135
  demo.queue().launch(debug=True)
 
112
 
113
  with gr.Blocks(css=css) as demo:
114
  gr.HTML(title)
115
+ #gr.HTML('''<center><a href="https://huggingface.co/spaces/ysharma/ChatGPTwithAPI?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>Duplicate the Space and run securely with your OpenAI API Key</center>''')
116
  with gr.Column(elem_id="col_container"):
117
  openai_api_key = gr.Textbox(type='password', label="Insira sua chave de API OpenAI aqui")
118
+ chatbot = gr.Chatbot(elem_id="chatbot")
119
  inputs = gr.Textbox(placeholder="Olá!", label="Digite uma entrada e pressione Enter", lines=3)
120
  state = gr.State([])
121
  b1 = gr.Button(value="Executar", variant="primary")
122
+
123
+ #inputs, top_p, temperature, top_k, repetition_penalty
124
  with gr.Accordion("Parameters", open=False):
125
+ top_p = gr.Slider( minimum=-0, maximum=1.0, value=1.0, step=0.05, interactive=True, label="Top-p (nucleus sampling)",)
126
+ temperature = gr.Slider( minimum=-0, maximum=5.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
127
+ #top_k = gr.Slider( minimum=1, maximum=50, value=4, step=1, interactive=True, label="Top-k",)
128
+ #repetition_penalty = gr.Slider( minimum=0.1, maximum=3.0, value=1.03, step=0.01, interactive=True, label="Repetition Penalty", )
129
+ chat_counter = gr.Number(value=0, visible=False, precision=0)
130
+
131
+ inputs.submit( predict, [inputs, top_p, temperature, openai_api_key, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
132
+ b1.click( predict, [inputs, top_p, temperature, openai_api_key, chat_counter, chatbot, state], [chatbot, state, chat_counter],)
133
+ b1.click(reset_textbox, [], [inputs])
134
+ inputs.submit(reset_textbox, [], [inputs])
135
+
136
+ #gr.Markdown(description)
137
  demo.queue().launch(debug=True)