Spaces:
Build error
Build error
| # stylization.py | |
| import cv2 | |
| import threading | |
| import numpy as np | |
| class Stylizer: | |
| def __init__(self): | |
| self.result = None | |
| def apply_style_threaded(self, image): | |
| thread = threading.Thread(target=self._stylize, args=(image,)) | |
| thread.start() | |
| thread.join() | |
| return self.result | |
| def _stylize(self, image): | |
| # Example stylization: stylization filter using OpenCV | |
| self.result = cv2.stylization(image, sigma_s=60, sigma_r=0.6) |