rein0421 commited on
Commit
95633b0
·
verified ·
1 Parent(s): cdec682

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -30
app.py CHANGED
@@ -283,35 +283,6 @@ def llm_to_process_image_simple(risk_level, image_path, point1, point2, threshol
283
  return save_dir + debug_image_path
284
 
285
 
286
- # ObjectDetector と WebScraper は非同期対応が必要です。
287
- # 仮のクラス定義(実際のあなたのクラスに置き換えてください)
288
- class ObjectDetector:
289
- def __init__(self, API_KEY):
290
- self.API_KEY = API_KEY
291
- self.prompt_objects = []
292
- self.text = ""
293
-
294
- async def detect_auto(self, image_path):
295
- print(f"Detecting objects automatically for {image_path}")
296
- await asyncio.sleep(0.1) # 非同期処理のシミュレーション
297
- return {"objects_to_remove": ["人", "車"]} # 例の戻り値
298
-
299
- async def detect_objects(self, image_path):
300
- print(f"Detecting specific objects for {image_path}")
301
- await asyncio.sleep(0.1) # 非同期処理のシミュレーション
302
- return [
303
- {'box_2d': [0.1, 0.1, 0.3, 0.3]}, # 例のバウンディングボックス (y1, x1, y2, x2)
304
- {'box_2d': [0.5, 0.5, 0.7, 0.7]}
305
- ]
306
-
307
- class WebScraper:
308
- def __init__(self, headless):
309
- self.headless = headless
310
-
311
- async def get_processed_documents(self, search_query, num_search_results):
312
- print(f"Scraping for: {search_query}")
313
- await asyncio.sleep(0.1) # 非同期処理のシミュレーション
314
- return {"cleaned_html_content": "個人情報漏洩に関するクリーンなコンテンツの例。"}
315
 
316
  async def llm_to_process_image_simple_auto(risk_level, image_path, point1, point2, thresholds=None):
317
  print(f"リスクレベル: {risk_level}, 画像パス: {image_path}, point1: {point1}, point2: {point2}, しきい値: {thresholds}")
@@ -1065,7 +1036,7 @@ async def create_mask_sum_auto(image: UploadFile = File(...), risk_level: int =
1065
  # 一意な識別子を生成
1066
  unique_id = uuid.uuid4().hex
1067
  input_path = save_image(image.file, f"./input_{timestamp}_{unique_id}.jpg")
1068
- mask_path,response = llm_to_process_image_simple_auto(risk_level, input_path, point1, point2,thresholds=thresholds)
1069
  output_path = f"./output_simple_lama_{timestamp}_{unique_id}.jpg"
1070
  print('point1,point2',point1,point2)#消去したくない範囲のこと
1071
  # OpenCVでインペイント
 
283
  return save_dir + debug_image_path
284
 
285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
286
 
287
  async def llm_to_process_image_simple_auto(risk_level, image_path, point1, point2, thresholds=None):
288
  print(f"リスクレベル: {risk_level}, 画像パス: {image_path}, point1: {point1}, point2: {point2}, しきい値: {thresholds}")
 
1036
  # 一意な識別子を生成
1037
  unique_id = uuid.uuid4().hex
1038
  input_path = save_image(image.file, f"./input_{timestamp}_{unique_id}.jpg")
1039
+ mask_path,response =await llm_to_process_image_simple_auto(risk_level, input_path, point1, point2,thresholds=thresholds)
1040
  output_path = f"./output_simple_lama_{timestamp}_{unique_id}.jpg"
1041
  print('point1,point2',point1,point2)#消去したくない範囲のこと
1042
  # OpenCVでインペイント