Rohit-Katkar2003's picture
Create app.py
18abd7d verified
raw
history blame contribute delete
585 Bytes
## chatbot app
import requests
import gradio as gr
with gr.Blocks() as demo:
chatbot = gr.Chatbot()
msg = gr.Textbox()
clear = gr.Button('clear')
def response(user_query , history):
url = f"https://text.pollinations.ai/{user_query}"
res = requests.get(url)
bot_reply = res.content.decode('utf-8')
history = history + [(user_query , bot_reply)]
return history , history
msg.submit(response , [msg,chatbot] , [chatbot,chatbot])
clear.click(lambda:[] , None , chatbot , queue=False)
demo.launch(share=True)