WaveCut commited on
Commit
4c67855
1 Parent(s): c11e306

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -28,6 +28,7 @@ pipe.enable_xformers_memory_efficient_attention()
28
 
29
  def super_esr(source_image,prompt,negative_prompt,strength,seed,num_inference_steps):
30
  condition_image = resize_for_condition_image(source_image, 1024)
 
31
 
32
  image = pipe(prompt=prompt,#"best quality",
33
  negative_prompt="blur, lowres, bad anatomy, bad hands, cropped, worst quality",
@@ -36,13 +37,13 @@ def super_esr(source_image,prompt,negative_prompt,strength,seed,num_inference_st
36
  width=condition_image.size[0],
37
  height=condition_image.size[1],
38
  strength=1.0,
39
- generator=seed,
40
  num_inference_steps=num_inference_steps,
41
- ).image
42
  # print(source_image,prompt,negative_prompt,strength,seed,num_inference_steps)
43
  return image
44
 
45
- #define laund take input nsame as super_esr function
46
 
47
  inputs=[
48
  gr.inputs.Image(type="pil",label="Source Image"),
@@ -61,7 +62,7 @@ examples=[
61
  ["https://i.imgur.com/9IqyX1F.png","best quality","blur, lowres, bad anatomy, bad hands, cropped, worst quality",1.0,0,100],
62
  ["https://i.imgur.com/9IqyX1F.png","best quality","blur, lowres, bad anatomy, bad hands, cropped, worst quality",1.0,0,100],
63
  ]
64
- #create queue the rerquests
65
  x=gr.Interface(fn=super_esr,inputs=inputs,outputs=outputs,title=title,description=description,examples=examples)
66
  x.launch()
67
 
 
28
 
29
  def super_esr(source_image,prompt,negative_prompt,strength,seed,num_inference_steps):
30
  condition_image = resize_for_condition_image(source_image, 1024)
31
+ generator = torch.Generator(device="cuda").manual_seed(seed)
32
 
33
  image = pipe(prompt=prompt,#"best quality",
34
  negative_prompt="blur, lowres, bad anatomy, bad hands, cropped, worst quality",
 
37
  width=condition_image.size[0],
38
  height=condition_image.size[1],
39
  strength=1.0,
40
+ generator=generator,
41
  num_inference_steps=num_inference_steps,
42
+ ).images[0]
43
  # print(source_image,prompt,negative_prompt,strength,seed,num_inference_steps)
44
  return image
45
 
46
+ # define and take input the same as the super_esr function
47
 
48
  inputs=[
49
  gr.inputs.Image(type="pil",label="Source Image"),
 
62
  ["https://i.imgur.com/9IqyX1F.png","best quality","blur, lowres, bad anatomy, bad hands, cropped, worst quality",1.0,0,100],
63
  ["https://i.imgur.com/9IqyX1F.png","best quality","blur, lowres, bad anatomy, bad hands, cropped, worst quality",1.0,0,100],
64
  ]
65
+ # create a queue of the requests
66
  x=gr.Interface(fn=super_esr,inputs=inputs,outputs=outputs,title=title,description=description,examples=examples)
67
  x.launch()
68