Alexander Bagus commited on
Commit
ef36217
·
1 Parent(s): ad015ab
Files changed (2) hide show
  1. app.py +3 -20
  2. static/header.html +3 -3
app.py CHANGED
@@ -46,28 +46,13 @@ def inference(
46
 
47
  scheduler = FlowMatchEulerDiscreteScheduler(num_train_timesteps=1000, shift=3)
48
  pipe.scheduler = scheduler
49
-
50
- ### load input_image
51
-
52
-
53
- # input_image = input_image.convert("RGB").resize((1024, 1024))
54
-
55
- # input_tensor = pil_image_to_torch_bgr(input_image).to(pipe.vae.device).to(pipe.vae.dtype)
56
- input_tensor = pipe.image_processor.preprocess(input_image, height=height, width=width)
57
- # input_tensor = image.to(dtype=torch.float32)
58
- input_tensor = input_tensor.to(device=pipe.vae.device, dtype=pipe.vae.dtype)
59
-
60
- # input_latents = _encode_vae_image(pipe=pipe, image=input_tensor, generator=generator)
61
- # input_latents = pipe.vae.encode(input_tensor).latent_dist.sample()
62
- # input_latents = input_latents * pipe.vae.config.scaling_factor
63
 
64
  image = pipe(
65
- # latents=input_latents,
66
  prompt=prompt,
67
  guidance_scale=guidance_scale,
68
  num_inference_steps=num_inference_steps,
69
- # width=width,
70
- # height=height,
71
  generator=generator,
72
  ).images[0]
73
 
@@ -96,7 +81,6 @@ with gr.Blocks() as demo:
96
  with gr.Column():
97
  gr.HTML(read_file("static/header.html"))
98
  with gr.Column(elem_id="col-container"):
99
- input_image = gr.Image(height=800,sources=['upload','clipboard'],image_mode='RGB', elem_id="image_upload", type="pil", label="Upload")
100
  with gr.Row():
101
  prompt = gr.Text(
102
  label="Prompt",
@@ -146,7 +130,7 @@ with gr.Blocks() as demo:
146
  minimum=0.0,
147
  maximum=10.0,
148
  step=0.1,
149
- value=0.0,
150
  )
151
 
152
  num_inference_steps = gr.Slider(
@@ -162,7 +146,6 @@ with gr.Blocks() as demo:
162
  triggers=[run_button.click, prompt.submit],
163
  fn=inference,
164
  inputs=[
165
- input_image,
166
  prompt,
167
  seed,
168
  randomize_seed,
 
46
 
47
  scheduler = FlowMatchEulerDiscreteScheduler(num_train_timesteps=1000, shift=3)
48
  pipe.scheduler = scheduler
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
 
50
  image = pipe(
 
51
  prompt=prompt,
52
  guidance_scale=guidance_scale,
53
  num_inference_steps=num_inference_steps,
54
+ width=width,
55
+ height=height,
56
  generator=generator,
57
  ).images[0]
58
 
 
81
  with gr.Column():
82
  gr.HTML(read_file("static/header.html"))
83
  with gr.Column(elem_id="col-container"):
 
84
  with gr.Row():
85
  prompt = gr.Text(
86
  label="Prompt",
 
130
  minimum=0.0,
131
  maximum=10.0,
132
  step=0.1,
133
+ value=5.0,
134
  )
135
 
136
  num_inference_steps = gr.Slider(
 
146
  triggers=[run_button.click, prompt.submit],
147
  fn=inference,
148
  inputs=[
 
149
  prompt,
150
  seed,
151
  randomize_seed,
static/header.html CHANGED
@@ -1,11 +1,11 @@
1
  <div style="text-align: center; max-width: 600px; margin: 0 auto;">
2
  <h1>
3
- Z-Image [Turbo] [img2img]
4
  </h1>
5
  <div class="grid-container" >
6
  <p>
7
- Besides making new images, Z-Image is also good at changing existing ones.
8
- It can fix problems like weird fingers and faces, and it can also add cool artistic styles.
9
  If you like my spaces, please support me by visiting <a href="https://aisudo.com/" target="_blank">AiSudo</a> for more image generation 😊
10
  </div>
11
  </div>
 
1
  <div style="text-align: center; max-width: 600px; margin: 0 auto;">
2
  <h1>
3
+ Z Image Turbo: Fast & Versatile Image Generation
4
  </h1>
5
  <div class="grid-container" >
6
  <p>
7
+ Z-Image-Turbo is a distilled version that excels in photorealistic image generation,
8
+ bilingual text rendering, and instruction adherence.
9
  If you like my spaces, please support me by visiting <a href="https://aisudo.com/" target="_blank">AiSudo</a> for more image generation 😊
10
  </div>
11
  </div>