Karin0616 commited on
Commit
944ab21
1 Parent(s): a59bb66

example radio

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -105,12 +105,24 @@ def sepia(input_img):
105
  fig = draw_plot(pred_img, seg)
106
  return fig
107
 
 
 
 
 
 
 
 
 
108
 
109
  demo = gr.Interface(fn=sepia,
110
  inputs=gr.Image(shape=(564,846)),
111
  outputs=['plot'],
112
  live=True,
113
- examples=["city1.jpg","city2.jpg","city3.jpg"],
 
 
 
 
114
  allow_flagging='never',
115
  title="This is a machine learning activity project at Kyunggi University.",
116
  theme="darkpeach",
 
105
  fig = draw_plot(pred_img, seg)
106
  return fig
107
 
108
+ def get_example_image(example):
109
+ if example == "city1":
110
+ return Image.open("city1.jpg")
111
+ elif example == "city2":
112
+ return Image.open("city2.jpg")
113
+ elif example == "city3":
114
+ return Image.open("city3.jpg")
115
+
116
 
117
  demo = gr.Interface(fn=sepia,
118
  inputs=gr.Image(shape=(564,846)),
119
  outputs=['plot'],
120
  live=True,
121
+ examples=gr.Radio(['city1', 'city2', 'city3'],
122
+ label="Example Images",
123
+ type="index",
124
+ default=0,
125
+ outputs=[get_example_image]),
126
  allow_flagging='never',
127
  title="This is a machine learning activity project at Kyunggi University.",
128
  theme="darkpeach",