niggathug commited on
Commit
bb670ba
1 Parent(s): b342a54

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -112,7 +112,7 @@ def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
112
 
113
 
114
  def run(
115
- image: dict,
116
  prompt: str,
117
  negative_prompt: str,
118
  style_name: str = DEFAULT_STYLE_NAME,
@@ -123,7 +123,7 @@ def run(
123
  seed: int = 0,
124
  progress=gr.Progress(track_tqdm=True),
125
  ) -> PIL.Image.Image:
126
- image = PIL.Image.fromarray(image["data"], mode="RGB")
127
  image = image.convert("RGB")
128
  image = TF.to_tensor(image) > 0.5
129
  image = TF.to_pil_image(image.to(torch.float32))
@@ -148,7 +148,7 @@ with gr.Blocks() as demo:
148
  with gr.Row():
149
  with gr.Column():
150
  with gr.Group():
151
- image = gr.Sketchpad(type="pil", image_mode="L")
152
  prompt = gr.Textbox(label="Prompt")
153
  style = gr.Dropdown(label="Style", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
154
  run_button = gr.Button("Run")
@@ -246,4 +246,4 @@ with gr.Blocks() as demo:
246
  )
247
 
248
  if __name__ == "__main__":
249
- demo.queue(max_size=20).launch()
 
112
 
113
 
114
  def run(
115
+ image: np.ndarray, # Modified this line
116
  prompt: str,
117
  negative_prompt: str,
118
  style_name: str = DEFAULT_STYLE_NAME,
 
123
  seed: int = 0,
124
  progress=gr.Progress(track_tqdm=True),
125
  ) -> PIL.Image.Image:
126
+ image = PIL.Image.fromarray(image["data"], mode="RGB") # Modified this line
127
  image = image.convert("RGB")
128
  image = TF.to_tensor(image) > 0.5
129
  image = TF.to_pil_image(image.to(torch.float32))
 
148
  with gr.Row():
149
  with gr.Column():
150
  with gr.Group():
151
+ image = gr.inputs.Image() # Modified this line
152
  prompt = gr.Textbox(label="Prompt")
153
  style = gr.Dropdown(label="Style", choices=STYLE_NAMES, value=DEFAULT_STYLE_NAME)
154
  run_button = gr.Button("Run")
 
246
  )
247
 
248
  if __name__ == "__main__":
249
+ demo.queue(max_size=20).launch()