quizbot / app.py
urge's picture
Create app.py
cb9aa27 verified
raw
history blame contribute delete
474 Bytes
import gradio as gr
import requests
import json
def bot_function(message, history):
history = json.loads(history) if isinstance(history, str) else history
response = requests.post("https://quizbot-sbct.onrender.com/quiz", params={"message": message, "history": json.dumps(history)})
output_from_api = response.json()
return output_from_api
out = gr.ChatInterface(bot_function, textbox=gr.Textbox(placeholder="Enter 'yes' to start the quiz"))
out.launch()