richylyq commited on
Commit
f1bf15c
1 Parent(s): 6ba5d10

update image display

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -1,6 +1,5 @@
1
  import gradio as gr
2
  import random
3
- from PIL import Image
4
 
5
  # Define the initial options
6
  options = ["pink"] * 15 + ["blue"] * 10
@@ -21,15 +20,15 @@ def draw():
21
  if options:
22
  option = spin_roulette()
23
  if option == "pink":
24
- pink = Image.open("images/pink.png")
25
  return pink
26
  else:
27
- blue = Image.open("images/blue.png")
28
  return blue
29
 
30
 
31
  with gr.Blocks() as demo:
32
  result = draw()
33
  draw_btn = gr.Button("Draw")
34
- draw_btn.click(fn=draw, inputs=[], outputs=result)
35
  demo.launch()
 
1
  import gradio as gr
2
  import random
 
3
 
4
  # Define the initial options
5
  options = ["pink"] * 15 + ["blue"] * 10
 
20
  if options:
21
  option = spin_roulette()
22
  if option == "pink":
23
+ pink = "images/pink.png"
24
  return pink
25
  else:
26
+ blue = "images/blue.png"
27
  return blue
28
 
29
 
30
  with gr.Blocks() as demo:
31
  result = draw()
32
  draw_btn = gr.Button("Draw")
33
+ draw_btn.click(fn=draw, inputs=[], outputs=gr.Image(value=result))
34
  demo.launch()