Sleepyp00 commited on
Commit
c01395c
·
1 Parent(s): cd8f858
Files changed (1) hide show
  1. app.py +13 -18
app.py CHANGED
@@ -1,36 +1,31 @@
1
  import gradio as gr
2
- import hopsworks
3
  from PIL import Image
 
4
 
5
  project = hopsworks.login()
 
6
 
7
- class ImageLoad:
8
- def __init__(self, path, project) -> None:
9
- self.path = path
10
- self.image_name = path[path.rfind('/') + 1:]
11
- self.project = project
12
-
13
- def __call__(self):
14
- dataset_api = self.project.get_dataset_api()
15
- dataset_api.download(self.path, overwrite=True)
16
- return Image.open(self.image_name)
17
-
18
 
 
 
 
 
19
 
20
  with gr.Blocks() as demo:
21
  with gr.Row():
22
  with gr.Column():
23
  gr.Label("Today's Predicted Image")
24
- input_img = gr.Image(value=ImageLoad("Resources/images/latest_wine.png", project), elem_id="predicted-img")
25
  with gr.Column():
26
  gr.Label("Today's Actual Image")
27
- input_img = gr.Image(value=ImageLoad("Resources/images/actual_wine.png", project), elem_id="actual-img")
28
  with gr.Row():
29
  with gr.Column():
30
  gr.Label("Recent Prediction History")
31
- input_img = gr.Image(value=ImageLoad("Resources/images/df_wine_recent.png", project), elem_id="recent-predictions")
32
  with gr.Column():
33
- gr.Label("Confusion Maxtrix with Historical Prediction Performance")
34
- input_img = gr.Image(value=ImageLoad("Resources/images/wine_confusion_matrix.png", project), elem_id="recent-predictions")
35
 
36
- demo.launch(share = True)
 
1
  import gradio as gr
 
2
  from PIL import Image
3
+ import hopsworks
4
 
5
  project = hopsworks.login()
6
+ fs = project.get_feature_store()
7
 
8
+ dataset_api = project.get_dataset_api()
 
 
 
 
 
 
 
 
 
 
9
 
10
+ dataset_api.download("Resources/images/latest_wine.png", overwrite=True)
11
+ dataset_api.download("Resources/images/actual_wine.png", overwrite=True)
12
+ dataset_api.download("Resources/images/df_wine_recent.png", overwrite=True)
13
+ dataset_api.download("Resources/images/wine_confusion_matrix.png", overwrite=True)
14
 
15
  with gr.Blocks() as demo:
16
  with gr.Row():
17
  with gr.Column():
18
  gr.Label("Today's Predicted Image")
19
+ input_img = gr.Image("latest_wine.png", elem_id="predicted-img")
20
  with gr.Column():
21
  gr.Label("Today's Actual Image")
22
+ input_img = gr.Image("actual_wine.png", elem_id="actual-img")
23
  with gr.Row():
24
  with gr.Column():
25
  gr.Label("Recent Prediction History")
26
+ input_img = gr.Image("df_wine_recent.png", elem_id="recent-predictions")
27
  with gr.Column():
28
+ gr.Label("Confusion Maxtrix with Historical Prediction Performance")
29
+ input_img = gr.Image("wine_confusion_matrix.png", elem_id="confusion-matrix")
30
 
31
+ demo.launch()