ktllc commited on
Commit
8eb4c63
·
1 Parent(s): 501c0dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -14,12 +14,12 @@ model_type = "vit_h"
14
  sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
15
 
16
  # Load the CLIP model
17
- # model, preprocess = clip.load("ViT-B/32")
18
- # device = "cuda" if torch.cuda.is_available() else "cpu"
19
- # model.to(device).eval()
20
-
21
  device = "cuda" if torch.cuda.is_available() else "cpu"
22
- model, preprocess = clip.load("ViT-B/32", device=device)
 
 
 
23
 
24
  def find_similarity(base64_image, text_input):
25
  try:
@@ -82,7 +82,7 @@ def segment_image(input_image, text_input):
82
 
83
  # Create Gradio components
84
  input_image = gr.inputs.Image()
85
- text_input = gr.inputs.Textbox(label="Text Input") # Use Textbox instead of Text
86
  output_images = gr.outputs.JSON()
87
 
88
  # Create a Gradio interface
 
14
  sam = sam_model_registry[model_type](checkpoint=sam_checkpoint)
15
 
16
  # Load the CLIP model
17
+ model, preprocess = clip.load("ViT-B/32")
 
 
 
18
  device = "cuda" if torch.cuda.is_available() else "cpu"
19
+ model.to(device).eval()
20
+
21
+ # device = "cuda" if torch.cuda.is_available() else "cpu"
22
+ # model, preprocess = clip.load("ViT-B/32", device=device)
23
 
24
  def find_similarity(base64_image, text_input):
25
  try:
 
82
 
83
  # Create Gradio components
84
  input_image = gr.inputs.Image()
85
+ text_input = gr.inputs.Textbox(label= "Text Input") # Use Textbox instead of Text
86
  output_images = gr.outputs.JSON()
87
 
88
  # Create a Gradio interface