Sleepyp00 commited on
Commit
e2fb8b9
·
1 Parent(s): e3c3795
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -26,14 +26,15 @@ dataset_api.download("Resources/images/wine_confusion_matrix.png", overwrite=Tru
26
 
27
 
28
  class ImageLoad:
29
- def __init__(self, path:str) -> None:
30
  self.path = path
31
  self.image_name = path[path.rfind('/') + 1:]
 
32
  print(self.image_name)
33
 
34
  def __call__(self):
35
- project = hopsworks.login()
36
- dataset_api = project.get_dataset_api()
37
  dataset_api.download(self.path, overwrite=True)
38
  return Image.open(self.image_name)
39
 
@@ -43,21 +44,21 @@ with gr.Blocks() as demo:
43
  with gr.Row():
44
  with gr.Column():
45
  gr.Label("Today's Predicted Image")
46
- input_img = gr.Image(value=ImageLoad("Resources/images/latest_wine.png"), elem_id="predicted-img")
47
  with gr.Column():
48
  gr.Label("Today's Actual Image")
49
- input_img = gr.Image(value=ImageLoad("Resources/images/actual_wine.png"), elem_id="actual-img")
50
  with gr.Row():
51
  with gr.Column():
52
  gr.Label("Recent Prediction History")
53
- input_img = gr.Image(value=ImageLoad("Resources/images/df_wine_recent.png"), elem_id="recent-predictions")
54
  with gr.Column():
55
  gr.Label("Confusion Maxtrix with Historical Prediction Performance")
56
  #input_img = gr.Image("wine_confusion_matrix.png", elem_id="confusion-matrix")
57
  """ image = gr.Image(show_label=False)
58
  demo.load(fn=load_images, inputs=None, outputs=image,
59
  show_progress=False) """
60
- input_img = gr.Image(value=ImageLoad("Resources/images/wine_confusion_matrix.png"), elem_id="recent-predictions")
61
  #demo.load(load_images)
62
 
63
  #load_images()
 
26
 
27
 
28
  class ImageLoad:
29
+ def __init__(self, path, project) -> None:
30
  self.path = path
31
  self.image_name = path[path.rfind('/') + 1:]
32
+ self.project = project
33
  print(self.image_name)
34
 
35
  def __call__(self):
36
+ #project = hopsworks.login()
37
+ dataset_api = self.project.get_dataset_api()
38
  dataset_api.download(self.path, overwrite=True)
39
  return Image.open(self.image_name)
40
 
 
44
  with gr.Row():
45
  with gr.Column():
46
  gr.Label("Today's Predicted Image")
47
+ input_img = gr.Image(value=ImageLoad("Resources/images/latest_wine.png", project), elem_id="predicted-img")
48
  with gr.Column():
49
  gr.Label("Today's Actual Image")
50
+ input_img = gr.Image(value=ImageLoad("Resources/images/actual_wine.png", project), elem_id="actual-img")
51
  with gr.Row():
52
  with gr.Column():
53
  gr.Label("Recent Prediction History")
54
+ input_img = gr.Image(value=ImageLoad("Resources/images/df_wine_recent.png", project), elem_id="recent-predictions")
55
  with gr.Column():
56
  gr.Label("Confusion Maxtrix with Historical Prediction Performance")
57
  #input_img = gr.Image("wine_confusion_matrix.png", elem_id="confusion-matrix")
58
  """ image = gr.Image(show_label=False)
59
  demo.load(fn=load_images, inputs=None, outputs=image,
60
  show_progress=False) """
61
+ input_img = gr.Image(value=ImageLoad("Resources/images/wine_confusion_matrix.png", project), elem_id="recent-predictions")
62
  #demo.load(load_images)
63
 
64
  #load_images()