RamAnanth1 commited on
Commit
b75b8f0
·
1 Parent(s): a53508f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -229,8 +229,8 @@ class image2canny:
229
  class canny2image:
230
  def __init__(self, device):
231
  print("Initialize the canny2image model.")
232
- low_threshold = 100
233
- high_threshold = 200
234
 
235
  # Models
236
  controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
@@ -252,7 +252,7 @@ class canny2image:
252
  def get_canny_filter(self,image):
253
  if not isinstance(image, np.ndarray):
254
  image = np.array(image)
255
- image = cv2.Canny(image, low_threshold, high_threshold)
256
  image = image[:, :, None]
257
  image = np.concatenate([image, image, image], axis=2)
258
  canny_image = Image.fromarray(image)
@@ -420,7 +420,7 @@ class ConversationBot:
420
 
421
  bot = ConversationBot()
422
  with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
423
- gr.Markdown("# Visual ChatGPT <p> Currently supports text, image captioning, image generation, and visual question answering</p>")
424
  openai_api_key_input = gr.Textbox(type = "password", label = "Enter your OpenAI API key here")
425
  chatbot = gr.Chatbot(elem_id="chatbot", label="Visual ChatGPT")
426
  state = gr.State([])
 
229
  class canny2image:
230
  def __init__(self, device):
231
  print("Initialize the canny2image model.")
232
+ self.low_threshold = 100
233
+ self.high_threshold = 200
234
 
235
  # Models
236
  controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-canny", torch_dtype=torch.float16)
 
252
  def get_canny_filter(self,image):
253
  if not isinstance(image, np.ndarray):
254
  image = np.array(image)
255
+ image = cv2.Canny(image, self.low_threshold, self.high_threshold)
256
  image = image[:, :, None]
257
  image = np.concatenate([image, image, image], axis=2)
258
  canny_image = Image.fromarray(image)
 
420
 
421
  bot = ConversationBot()
422
  with gr.Blocks(css="#chatbot .overflow-y-auto{height:500px}") as demo:
423
+ gr.Markdown("# Visual ChatGPT <p> Visual ChatGPT combines visual foundation models and ChatGPT to send,receive and process images during chatting.This demo currently supports text, image captioning, image generation, and visual question answering</p>")
424
  openai_api_key_input = gr.Textbox(type = "password", label = "Enter your OpenAI API key here")
425
  chatbot = gr.Chatbot(elem_id="chatbot", label="Visual ChatGPT")
426
  state = gr.State([])