Spaces:
Sleeping
Sleeping
owwe
commited on
Commit
·
ca3021b
1
Parent(s):
31a2083
first commit
Browse files- app.py +36 -0
- requirements.txt +2 -0
app.py
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
import hopsworks
|
3 |
+
|
4 |
+
project = hopsworks.login(project="DD2223_lab1")
|
5 |
+
fs = project.get_feature_store()
|
6 |
+
|
7 |
+
dataset_api = project.get_dataset_api()
|
8 |
+
|
9 |
+
dataset_api.download("Resources/images/latest_wine.txt")
|
10 |
+
dataset_api.download("Resources/images/actual_wine.txt")
|
11 |
+
dataset_api.download("Resources/images/df_recent.png")
|
12 |
+
dataset_api.download("Resources/images/confusion_matrix.png")
|
13 |
+
|
14 |
+
# Function to read text from a file and return it
|
15 |
+
def read_text_file(file_path):
|
16 |
+
with open(file_path, 'r') as file:
|
17 |
+
content = file.read()
|
18 |
+
return content
|
19 |
+
|
20 |
+
with gr.Blocks() as demo:
|
21 |
+
with gr.Row():
|
22 |
+
with gr.Column():
|
23 |
+
gr.Label("Today's Predicted Wine Quality")
|
24 |
+
predicted_wine_text = gr.Text(read_text_file("latest_wine.txt"), elem_id="recent-text")
|
25 |
+
with gr.Column():
|
26 |
+
gr.Label("Today's Actual Wine Quality")
|
27 |
+
actual_wine_text = gr.Text(read_text_file("actual_wine.txt"), elem_id="actual-text")
|
28 |
+
with gr.Row():
|
29 |
+
with gr.Column():
|
30 |
+
gr.Label("Recent Prediction History")
|
31 |
+
recent_predictions_img = gr.Image("df_recent.png", elem_id="recent-predictions")
|
32 |
+
with gr.Column():
|
33 |
+
gr.Label("Confusion Matrix with Historical Prediction Performance")
|
34 |
+
confusion_matrix_img = gr.Image("confusion_matrix.png", elem_id="confusion-matrix")
|
35 |
+
|
36 |
+
demo.launch()
|
requirements.txt
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
hopsworks
|
2 |
+
httpx==0.24.1
|