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() |