MultiplyGame / app.py
svalcin's picture
Update app.py
ab9ccf0
raw
history blame
No virus
666 Bytes
import gradio as gr
import pickle
import numpy as np
class QModel():
def __init__(self):
self.qtable = qtab
def predict(self,state_n, n_questions=1):
n_questions = int(n_questions)
state_n = int(state_n)
if (n_questions==1):
return np.argmax(self.qtable[state_n][:])
return np.argsort(self.qtable[state_n][:])[-n_questions:]
learner = pickle.load(open("q-learn-multiply-game.pkl", "rb"))
def predict_next_questions(state, n_questions):
return learner.predict(state, n_questions)
intf = gr.Interface(fn=predict_next_questions, inputs="number", outputs="json")
intf.launch()