Sorry Im newbie. Someone know how I can clear the input with this code?
def chatgpt_clone(input, history):
history = history or
s = list(sum(history, ()))
s.append(input)
inp = ’ '.join(s)
output = openai_create(inp, history, s)
history.append((input, output))
# Abre el archivo txt en modo agregar
with open(“conversacion.txt”, “a”) as file:
file.write("User: " + input + “\n” + "Assistant: " + output + “\n”)
return history, history
block = gr.Blocks()
with block:
gr.Markdown(“”“
Build Yo’own ChatGPT with OpenAI API & Gradio
“””)
chatbot = gr.Chatbot()
message = gr.Textbox(placeholder=prompt)
state = gr.State()
submit = gr.Button(“SEND”)
submit.click(chatgpt_clone, inputs=[message, state], outputs=[chatbot, state])
block.launch(debug=True)