Khalil commited on
Commit
b969123
1 Parent(s): 35ed471

fix interface not lunching error 'debug=True'.

Browse files
Files changed (1) hide show
  1. app.py +10 -12
app.py CHANGED
@@ -9,8 +9,6 @@ if not Path('./Text2Punk-final-7.pt').exists() and not Path('./clip-final.pt').e
9
 
10
  # plot
11
 
12
- import matplotlib.pyplot as plt
13
- import numpy as np
14
  from PIL import Image
15
 
16
  # gradio
@@ -35,9 +33,7 @@ def compose_predictions(images):
35
  image_grid = Image.new("RGB", (b*w*4, h*4), color=0)
36
 
37
  for i in range(b):
38
- # resize(images[i], 96)
39
- print(images[i].shape)
40
- img_ = to_pil_image(images[i])
41
  image_grid.paste(img_, (i*w*4, increased_h))
42
 
43
  return image_grid
@@ -59,15 +55,16 @@ def run_inference(prompt, num_images=32, batch_size=32, num_preds=8):
59
 
60
 
61
  outputs = [
62
- gr.outputs.HTML(label=""), # To be used as title
63
- gr.outputs.Image(label=''),
64
  ]
65
 
66
  description = """
67
  Text2Cryptopunks is an AI model that generates Cryptopunks images from text prompt:
68
  """
69
 
70
- gr.Interface(run_inference,
 
71
  inputs=[gr.inputs.Textbox(label='type somthing like this : "An Ape CryptoPunk that has 2 Attributes, a Pigtails and a Medical Mask."')],
72
  outputs=outputs,
73
  title='Text2Cryptopunks',
@@ -76,7 +73,8 @@ gr.Interface(run_inference,
76
  layout='vertical',
77
  theme='huggingface',
78
  examples=[['Cute Alien cryptopunk that has a 2 Attributes, a Pipe, and a Beanie.'], ['A low resolution photo of punky-looking Ape that has 2 Attributes, a Beanie, and a Medical Mask.']],
79
- allow_flagging=False,
80
- live=False,
81
- # server_port=8999
82
- ).launch(share=True)
 
 
9
 
10
  # plot
11
 
 
 
12
  from PIL import Image
13
 
14
  # gradio
 
33
  image_grid = Image.new("RGB", (b*w*4, h*4), color=0)
34
 
35
  for i in range(b):
36
+ img_ = to_pil_image(resize(images[i], 96))
 
 
37
  image_grid.paste(img_, (i*w*4, increased_h))
38
 
39
  return image_grid
 
55
 
56
 
57
  outputs = [
58
+ gr.outputs.HTML(label="Output Title"), # To be used as title
59
+ gr.outputs.Image(type="pil", label="Output Image"),
60
  ]
61
 
62
  description = """
63
  Text2Cryptopunks is an AI model that generates Cryptopunks images from text prompt:
64
  """
65
 
66
+ gr.Interface(
67
+ fn=run_inference,
68
  inputs=[gr.inputs.Textbox(label='type somthing like this : "An Ape CryptoPunk that has 2 Attributes, a Pigtails and a Medical Mask."')],
69
  outputs=outputs,
70
  title='Text2Cryptopunks',
 
73
  layout='vertical',
74
  theme='huggingface',
75
  examples=[['Cute Alien cryptopunk that has a 2 Attributes, a Pipe, and a Beanie.'], ['A low resolution photo of punky-looking Ape that has 2 Attributes, a Beanie, and a Medical Mask.']],
76
+ enable_queue=True,
77
+ # allow_flagging=False,
78
+ # live=False,
79
+ # verbose=True,
80
+ ).launch(debug=True)