Compare commits

..

No commits in common. "ce1c9bf3abe474eefe8ce37770dda450d03105af" and "09b3487cf9b5a97f4add4657cd59b30f67bfec62" have entirely different histories.

View File

@ -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).lstrip("analysis-").lstrip("anonim-")
stripped_image_name = str(img_name).replace("analysis-", "").replace("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,13 +83,34 @@ class State(rx.State):
async def image_anonymization(self, img_name: str):
if img_name in self.img:
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)
image_path = rx.get_asset_path(img_name)
new_img_name = "anonim-" + img_name
new_image_path = rx.get_asset_path(new_img_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_image_name)
upload_file = rx.UploadFile(file=open(new_image_path, 'rb'), filename=new_img_name)
self.delete_image(img_name)
await self.handle_upload([upload_file])
self.img=self.img
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