File size: 474 Bytes
cb9aa27
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()