gokaygokay commited on
Commit
a3165fa
1 Parent(s): 54e5a29
Files changed (1) hide show
  1. app.py +9 -4
app.py CHANGED
@@ -21,18 +21,23 @@ def create_interface():
21
  with gr.Column(scale=2):
22
  custom = gr.Textbox(label="Custom Input Prompt (optional)", lines=3)
23
 
 
24
  prompt_type = gr.Dropdown(
25
- choices=["Long", "Short", "Medium", "OnlyObjects", "NoFigure", "Landscape", "Fantasy"],
26
  label="Prompt Type",
27
- value="Long",
28
  interactive=True
29
  )
30
 
31
  # Add a State component to store the selected prompt type
32
- prompt_type_state = gr.State("Long")
33
 
34
- # Update the function to use State
35
  def update_prompt_type(value, state):
 
 
 
 
36
  print(f"Updated prompt type: {value}")
37
  return value, value
38
 
 
21
  with gr.Column(scale=2):
22
  custom = gr.Textbox(label="Custom Input Prompt (optional)", lines=3)
23
 
24
+ prompt_types = ["Random", "Long", "Short", "Medium", "OnlyObjects", "NoFigure", "Landscape", "Fantasy"]
25
  prompt_type = gr.Dropdown(
26
+ choices=prompt_types,
27
  label="Prompt Type",
28
+ value="Random",
29
  interactive=True
30
  )
31
 
32
  # Add a State component to store the selected prompt type
33
+ prompt_type_state = gr.State("Random")
34
 
35
+ # Update the function to use State and handle Random option
36
  def update_prompt_type(value, state):
37
+ if value == "Random":
38
+ new_value = random.choice([t for t in prompt_types if t != "Random"])
39
+ print(f"Random prompt type selected: {new_value}")
40
+ return value, new_value
41
  print(f"Updated prompt type: {value}")
42
  return value, value
43