Mathiasangel commited on
Commit
0c97efe
·
verified ·
1 Parent(s): 8736518

import gradio as gr

# Dit is mijn "antwoordfunctie"
def chat(user_message, history=[]):
# history is een lijst van alle eerdere berichten
history.append(("Jij", user_message))
antwoord = "Angel zegt: " + user_message[::-1] # tijdelijk antwoord (om te testen draai ik jouw tekst om 😉)
history.append(("Angel", antwoord))
return history, history

with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox()
clear = gr.Button("Wissen")

def respond(message, history):
return chat(message, history)

msg.submit(respond, [msg, chatbot], [chatbot, chatbot])
clear.click(lambda: None, None, chatbot, queue=False)

demo.launch()

Files changed (1) hide show
  1. App.py +0 -7
App.py DELETED
@@ -1,7 +0,0 @@
1
- import gradio as gr
2
-
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
-
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()