SeoJunn commited on
Commit
e1c76b3
β€’
1 Parent(s): 25313d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -29
app.py CHANGED
@@ -4,7 +4,6 @@ from matplotlib import gridspec
4
  import matplotlib.pyplot as plt
5
  import numpy as np
6
  from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
7
- from transformers import DetrImageProcessor, DetrForObjectDetection
8
  import torch
9
  import tensorflow as tf
10
  from PIL import ImageDraw
@@ -102,34 +101,6 @@ def sepia(inputs, button_text):
102
  """객체 κ²€μΆœ λ˜λŠ” μ„Έκ·Έλ©˜ν…Œμ΄μ…˜μ„ μˆ˜ν–‰ν•˜κ³  κ²°κ³Όλ₯Ό λ°˜ν™˜ν•˜λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€."""
103
 
104
  input_img = Image.fromarray(inputs)
105
- # if button_text == "detection":
106
- # inputs_detection = processor_detection(images=input_img, return_tensors="pt")
107
- # outputs_detection = model_detection(**inputs_detection)
108
-
109
- # target_sizes = torch.tensor([input_img.size[::-1]])
110
- # results_detection = processor_detection.post_process_object_detection(
111
- # outputs_detection, target_sizes=target_sizes, threshold=0.9
112
- # )[0]
113
-
114
- # draw = ImageDraw.Draw(input_img)
115
- # for score, label, box in zip(
116
- # results_detection["scores"],
117
- # results_detection["labels"],
118
- # results_detection["boxes"],
119
- # ):
120
- # box = [round(i, 2) for i in box.tolist()]
121
- # label_name = model_detection.config.id2label[label.item()]
122
- # print(
123
- # f"Detected {label_name} with confidence "
124
- # f"{round(score.item(), 3)} at location {box}"
125
- # )
126
- # draw.rectangle(box, outline="red", width=3)
127
- # draw.text((box[0], box[1]), label_name, fill="red", font=None)
128
-
129
- # fig = plt.figure(figsize=(20, 15))
130
- # plt.imshow(input_img)
131
- # plt.axis("off")
132
- # return fig
133
 
134
  inputs_segmentation = feature_extractor(images=input_img, return_tensors="tf")
135
  outputs_segmentation = model_segmentation(**inputs_segmentation)
 
4
  import matplotlib.pyplot as plt
5
  import numpy as np
6
  from transformers import SegformerFeatureExtractor, TFSegformerForSemanticSegmentation
 
7
  import torch
8
  import tensorflow as tf
9
  from PIL import ImageDraw
 
101
  """객체 κ²€μΆœ λ˜λŠ” μ„Έκ·Έλ©˜ν…Œμ΄μ…˜μ„ μˆ˜ν–‰ν•˜κ³  κ²°κ³Όλ₯Ό λ°˜ν™˜ν•˜λŠ” ν•¨μˆ˜μž…λ‹ˆλ‹€."""
102
 
103
  input_img = Image.fromarray(inputs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  inputs_segmentation = feature_extractor(images=input_img, return_tensors="tf")
106
  outputs_segmentation = model_segmentation(**inputs_segmentation)