whispy commited on
Commit
3223328
1 Parent(s): 4e0c1fc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -10
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import gradio as gr
2
  from PIL import Image
3
- import requests
4
  import hopsworks
5
  import joblib
6
 
@@ -8,7 +7,10 @@ import joblib
8
  project = hopsworks.login(project="finetune")
9
  fs = project.get_feature_store()
10
  dataset_api = project.get_dataset_api()
11
-
 
 
 
12
  def show_reloaded_images():
13
  '''
14
  Show new images.
@@ -19,7 +21,7 @@ def show_reloaded_images():
19
  dataset_api.download(img, overwrite=True)
20
  # download snow prediction forecast
21
  dataset_api.download("Resources/img_prediction/plot.png", overwrite=True)
22
- # optput images
23
  plot_pred = Image.open("plot.png")
24
  img1 = Image.open("1.png")
25
  img2 = Image.open("2.png")
@@ -31,6 +33,9 @@ def show_reloaded_images():
31
 
32
  return output
33
 
 
 
 
34
  def show_history():
35
  '''
36
  Get history of predictions.
@@ -47,14 +52,16 @@ with gr.Blocks() as demo:
47
  btn = gr.Button("New prediction").style(full_width=True)
48
  with gr.Row():
49
  plot_pred = gr.Image(label="Predicted snow height").style(height=400) # plotted graph
50
- with gr.Row():
51
  #input_img1 = gr.Image("1.png", elem_id="Day 1")
52
- img1 = gr.Image().style(width=25)
53
- img2 = gr.Image().style(width=25)
54
- img3 = gr.Image().style(width=25)
55
- img4 = gr.Image().style(width=25)
56
- img5 = gr.Image().style(width=25)
57
- img6 = gr.Image().style(width=25)
 
 
58
 
59
  with gr.TabItem("Accuracy of past 10 days"):
60
  with gr.Row():
 
1
  import gradio as gr
2
  from PIL import Image
 
3
  import hopsworks
4
  import joblib
5
 
 
7
  project = hopsworks.login(project="finetune")
8
  fs = project.get_feature_store()
9
  dataset_api = project.get_dataset_api()
10
+
11
+ ###########################################
12
+ # DOWNLOAD AND OPEN IMAGES FROM HOPSWORKS #
13
+ ###########################################
14
  def show_reloaded_images():
15
  '''
16
  Show new images.
 
21
  dataset_api.download(img, overwrite=True)
22
  # download snow prediction forecast
23
  dataset_api.download("Resources/img_prediction/plot.png", overwrite=True)
24
+ # output images
25
  plot_pred = Image.open("plot.png")
26
  img1 = Image.open("1.png")
27
  img2 = Image.open("2.png")
 
33
 
34
  return output
35
 
36
+ ######################################
37
+ # DOWNLOAD AND SHOW ACCURACY HISTORY #
38
+ ######################################
39
  def show_history():
40
  '''
41
  Get history of predictions.
 
52
  btn = gr.Button("New prediction").style(full_width=True)
53
  with gr.Row():
54
  plot_pred = gr.Image(label="Predicted snow height").style(height=400) # plotted graph
55
+ with gr.Row(equal_width=True):
56
  #input_img1 = gr.Image("1.png", elem_id="Day 1")
57
+ img1 = gr.Image(label="Tomorrow")
58
+ img2 = gr.Image(label="In 2 days")
59
+ img3 = gr.Image(label="In 3 days")
60
+ img4 = gr.Image(label="In 4 days")
61
+ img5 = gr.Image(label="In 5 days")
62
+ img6 = gr.Image(label="In 6 days")
63
+ with gr.Row():
64
+ img_legend = gr.Image("emoji-legend.png", label="Legend").style(height=300)
65
 
66
  with gr.TabItem("Accuracy of past 10 days"):
67
  with gr.Row():