Titanic_monitor / app.py
CsanadT's picture
Update app.py
3beb734
import gradio as gr
import hopsworks
project = hopsworks.login()
fs = project.get_feature_store()
dataset_api = project.get_dataset_api()
dataset_api.download("Resources/predictions/latest_prediction.txt", overwrite=True)
dataset_api.download("Resources/predictions/actual_prediction.txt", overwrite=True)
dataset_api.download("Resources/images/df_recent_titanic.png", overwrite=True)
dataset_api.download("Resources/images/confusion_matrix_titanic.png", overwrite=True)
with open("latest_prediction.txt") as file:
latest_pred = file.read()
with open("actual_prediction.txt") as file:
actual_pred = file.read()
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
gr.Label("Today's Prediction")
input_img = gr.Textbox(latest_pred, elem_id="predicted person")
with gr.Column():
gr.Label("Today's Actual answer")
input_img = gr.Textbox(actual_pred, elem_id="actual person")
with gr.Row():
with gr.Column():
gr.Label("Recent Prediction History")
input_img = gr.Image("df_recent_titanic.png", elem_id="recent-predictions")
with gr.Column():
gr.Label("Confusion Maxtrix with Historical Prediction Performance")
input_img = gr.Image("confusion_matrix_titanic.png", elem_id="confusion-matrix")
demo.launch()