mrbeliever commited on
Commit
c8e34aa
1 Parent(s): 375fdfe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -11
app.py CHANGED
@@ -7,9 +7,10 @@ model3 = gr.load("models/runwayml/stable-diffusion-v1-5")
7
  model4 = gr.load("models/stablediffusionapi/juggernaut-xl-v5")
8
  model5 = gr.load("models/stabilityai/stable-diffusion-xl-base-1.0")
9
 
10
- # Function to switch between models
11
- def generate_image(model, text_input):
12
- return model(text_input)
 
13
 
14
  # Define the models and their names
15
  models = {
@@ -29,16 +30,9 @@ input_text = gr.Textbox(label="Input Text", placeholder="Enter text here") # Se
29
  # Create the output image
30
  output_image = gr.Image()
31
 
32
- # Create a function that will be called when the "Generate" button is clicked
33
- def generate_button_click():
34
- selected_model_name = model_dropdown.value
35
- selected_model = models[selected_model_name]
36
- result_image = generate_image(selected_model, input_text.value)
37
- output_image.image(result_image)
38
-
39
  # Create the interface
40
  iface = gr.Interface(
41
-
42
  inputs=[model_dropdown, input_text],
43
  outputs=output_image,
44
  )
 
7
  model4 = gr.load("models/stablediffusionapi/juggernaut-xl-v5")
8
  model5 = gr.load("models/stabilityai/stable-diffusion-xl-base-1.0")
9
 
10
+ # Function to switch between models and generate image
11
+ def generate_image(selected_model_name, text_input):
12
+ selected_model = models[selected_model_name]
13
+ return selected_model(text_input)
14
 
15
  # Define the models and their names
16
  models = {
 
30
  # Create the output image
31
  output_image = gr.Image()
32
 
 
 
 
 
 
 
 
33
  # Create the interface
34
  iface = gr.Interface(
35
+ fn=generate_image,
36
  inputs=[model_dropdown, input_text],
37
  outputs=output_image,
38
  )