JV A commited on
Commit
680cac7
·
1 Parent(s): 1b2dc7d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -4,6 +4,7 @@ import json
4
  import PIL.Image
5
  from io import BytesIO
6
  import os
 
7
  def generate_image(prompt, negative_prompt, scheduler, steps, width, height, restore_faces):
8
  # Define the API endpoint
9
  apiUrl = os.getenv("API_URL")
@@ -74,16 +75,16 @@ def generate_image(prompt, negative_prompt, scheduler, steps, width, height, res
74
  image = PIL.Image.open(BytesIO(image_response.content))
75
 
76
  return image
77
- else:
78
  raise Exception("API request failed with status code " + str(response.status_code))
79
 
80
  # Define the Gradio interface
81
  iface = gr.Interface(
82
  fn=generate_image,
83
  inputs=[
84
- gr.inputs.Textbox(label="Prompt"),
85
- gr.inputs.Textbox(label="Negative Prompt"),
86
- gr.inputs.Dropdown(choices=[
87
  "Euler a",
88
  "Euler",
89
  "LMS",
@@ -104,12 +105,12 @@ iface = gr.Interface(
104
  "DDIM",
105
  "PLMS"
106
  ], label="Scheduler", default="Euler a"),
107
- gr.inputs.Slider(minimum=10, maximum=60, default=30, label="Steps"),
108
- gr.inputs.Slider(minimum=512, maximum=1500, default=768, label="Width"),
109
- gr.inputs.Slider(minimum=512, maximum=1500, default=768, label="Height"),
110
- gr.inputs.Checkbox(label="Restore Faces")
111
  ],
112
- outputs="image",
113
  title="Freedom Demonstration",
114
  description = """
115
  Testing environment for the Freedom Model. Finetuned model of SD 2.1 768X produced by <a href='https://twitter.com/artificialguybr' target='_blank'>@artificialguybr</a>.<br>
@@ -118,8 +119,8 @@ You can find example prompts <a href='LINK_TO_EXAMPLE_PROMPTS' target='_blank'>h
118
  Demonstration running on the <a href='LINK_TO_MAKEAI.RUN_API' target='_blank'>makeai.run API</a>.<br>
119
  Thanks to <a href='LINK_TO_REDMOND.AI' target='_blank'>Redmond.ai</a> for providing GPU Time and sponsoring this model.
120
  """,
121
- allow_flagging=False
122
  )
123
 
124
  # Launch the app
125
- iface.launch()
 
4
  import PIL.Image
5
  from io import BytesIO
6
  import os
7
+
8
  def generate_image(prompt, negative_prompt, scheduler, steps, width, height, restore_faces):
9
  # Define the API endpoint
10
  apiUrl = os.getenv("API_URL")
 
75
  image = PIL.Image.open(BytesIO(image_response.content))
76
 
77
  return image
78
+ else:
79
  raise Exception("API request failed with status code " + str(response.status_code))
80
 
81
  # Define the Gradio interface
82
  iface = gr.Interface(
83
  fn=generate_image,
84
  inputs=[
85
+ gr.components.Textbox(label="Prompt"),
86
+ gr.components.Textbox(label="Negative Prompt"),
87
+ gr.components.Dropdown(choices=[
88
  "Euler a",
89
  "Euler",
90
  "LMS",
 
105
  "DDIM",
106
  "PLMS"
107
  ], label="Scheduler", default="Euler a"),
108
+ gr.components.Slider(minimum=10, maximum=60, default=30, label="Steps"),
109
+ gr.components.Slider(minimum=512, maximum=1500, default=768, label="Width"),
110
+ gr.components.Slider(minimum=512, maximum=1500, default=768, label="Height"),
111
+ gr.components.Checkbox(label="Restore Faces")
112
  ],
113
+ outputs=gr.components.Image(),
114
  title="Freedom Demonstration",
115
  description = """
116
  Testing environment for the Freedom Model. Finetuned model of SD 2.1 768X produced by <a href='https://twitter.com/artificialguybr' target='_blank'>@artificialguybr</a>.<br>
 
119
  Demonstration running on the <a href='LINK_TO_MAKEAI.RUN_API' target='_blank'>makeai.run API</a>.<br>
120
  Thanks to <a href='LINK_TO_REDMOND.AI' target='_blank'>Redmond.ai</a> for providing GPU Time and sponsoring this model.
121
  """,
122
+ allow_flagging='never'
123
  )
124
 
125
  # Launch the app
126
+ iface.launch()