BLUR-7
This commit is contained in:
parent
8e7ac6af76
commit
a1159858d8
@ -3,7 +3,7 @@
|
||||
import reflex as rx
|
||||
import os
|
||||
import stat
|
||||
from blurme import styles
|
||||
#from blurme import styles
|
||||
import asyncio
|
||||
from graphics.image_modification import blur_boxes_on_image
|
||||
from graphics.image_modification import show_image_with_boxes
|
||||
@ -70,7 +70,7 @@ class State(rx.State):
|
||||
|
||||
async def image_analysis(self, img_name: str):
|
||||
if img_name in self.img:
|
||||
stripped_image_name = str(img_name).replace("analysis-", "").replace("anonim-", "")
|
||||
stripped_image_name = str(img_name).lstrip("analysis-").lstrip("anonim-")
|
||||
image_path = rx.get_asset_path(stripped_image_name)
|
||||
#timestamp = datetime.now().strftime("%Y%m%d%H%M%S%f")
|
||||
new_image_name = f"analysis-{stripped_image_name}"
|
||||
@ -83,34 +83,13 @@ class State(rx.State):
|
||||
|
||||
async def image_anonymization(self, img_name: str):
|
||||
if img_name in self.img:
|
||||
image_path = rx.get_asset_path(img_name)
|
||||
new_img_name = "anonim-" + img_name
|
||||
new_image_path = rx.get_asset_path(new_img_name)
|
||||
stripped_image_name = str(img_name).lstrip("analysis-").lstrip("anonim-")
|
||||
image_path = rx.get_asset_path(stripped_image_name)
|
||||
#timestamp = datetime.now().strftime("%Y%m%d%H%M%S%f")
|
||||
new_image_name = f"anonim-{stripped_image_name}"
|
||||
new_image_path = rx.get_asset_path(new_image_name)
|
||||
blur_boxes_on_image(image_path, detect(image_path), new_image_path)
|
||||
upload_file = rx.UploadFile(file=open(new_image_path, 'rb'), filename=new_img_name)
|
||||
upload_file = rx.UploadFile(file=open(new_image_path, 'rb'), filename=new_image_name)
|
||||
self.delete_image(img_name)
|
||||
await self.handle_upload([upload_file])
|
||||
self.img=self.img
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#async def toggle_dark_mode(self):
|
||||
# self.dark_mode = not self.dark_mode
|
||||
# print(f"Dark Mode State: {self.dark_mode}")
|
||||
|
||||
#class State(rx.State):
|
||||
# def __init__(self):
|
||||
# super().__init__()
|
||||
# self.dark_mode_state: bool = False
|
||||
# def __str__(self):
|
||||
# self.dark_mode_state
|
||||
# def toggle_dark_mode(self) -> None:
|
||||
# self.dark_mode_state = not self.dark_mode_state
|
||||
# text_color = styles.text_color_light if self.dark_mode_state == True else styles.text_color_dark
|
||||
# styles.text_color = text_color
|
||||
# print(f"Dark Mode State: {self.dark_mode_state}")
|
||||
# print(f"Current Text Color: {text_color}")
|
||||
# pass
|
||||
self.img=self.img
|
Loading…
Reference in New Issue
Block a user