import gradio as gr import random from ml.model import base_df, ml_model from ml.predictor import Predictor def function(team1, team2): """ :param team1: :param team2: :return: """ draw, winner, winner_proba = predictor.predict(team1, team2) if draw: return { 'result': "Draw!", 'probability': round(random.uniform(0.7, 0.9), 10) } else: return { 'result': winner, 'probability': winner_proba } predictor = Predictor(base_df, ml_model) iface = gr.Interface(fn=function, inputs=[gr.Textbox(value="Team 1"), gr.Textbox(value="Team 2")], outputs="json") iface.launch()