meeww commited on
Commit
8ecee54
·
verified ·
1 Parent(s): fba866e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -60,17 +60,19 @@ def gen(seed):
60
  return imgArr
61
 
62
 
63
- # New function to handle text input or surprise me functionality
64
- def handle_input(seed=None):
65
- if seed is None or seed == "":
66
  seed = random.randint(0, 1000)
67
  return gen(seed)
68
 
69
 
 
70
  iface = gr.Interface(
71
  fn=handle_input,
72
  inputs=[
73
- gr.Text(label="Seed"), # Text input for seed
 
74
  ],
75
  outputs=gr.Gallery(label="Generated Skins"),
76
  title = "Minecraft Skin Generator <style>img{image-rendering: pixelated;}</style>", #<-- EWW GROSS IK IK IM SORRY, BUT THAT'S THE ONLY WAY I FOUND IT TO WORK
 
60
  return imgArr
61
 
62
 
63
+ # Function to handle input, deciding based on user choice
64
+ def handle_input(seed, action):
65
+ if action == "Surprise Me":
66
  seed = random.randint(0, 1000)
67
  return gen(seed)
68
 
69
 
70
+
71
  iface = gr.Interface(
72
  fn=handle_input,
73
  inputs=[
74
+ gr.Text(label="Seed", placeholder="Enter a seed or use 'Surprise Me'"), # Text input for seed
75
+ gr.Radio(choices=["Generate", "Surprise Me"], label="Action", default="Generate"), # Radio buttons to select action
76
  ],
77
  outputs=gr.Gallery(label="Generated Skins"),
78
  title = "Minecraft Skin Generator <style>img{image-rendering: pixelated;}</style>", #<-- EWW GROSS IK IK IM SORRY, BUT THAT'S THE ONLY WAY I FOUND IT TO WORK