TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #425 · 20 апр.

Недавно делал быстрый прототип асинхронного приложения в котором требовалось вызывать много синхронного кода. Да, я знаю, что это не лучший дизайн, но нужно было быстрое решение на один процесс и без очередей. Поэтому я выполнял код в потоках. Выглядело это примерно так: from fastapi.concurrency import run_in_threadpool async def execute(data: DataRequest) -> DataResponse: try: result = await run_in_threadpool(sync_function, data) return DataResponse(data=result) except Exception as e: return DataResponse( error=str(e), success=False, ) В общем работает нормально. Для всех вызовов под капотом используется общий тредпул, всё работает предсказуемо. Но потребовалось изменить количество запускаемых в пуле потоков (по умолчанию создается 40 воркеров). Так как дело происходит с FastAPI, делается это через lifespan используя настройки anyio: import anyio @asynccontextmanager async def lifespan(app: FastAPI): limiter = anyio.to_thread.current_default_thread_limiter() limiter.total_tokens = 100 yield # если вдруг нужно вернуть обратно limiter.total_tokens = 40 Зачем менять количество воркеров? - уменьшить, если оперативки мало (один тред занимает ~8мб) - увеличить чтобы выдержать нагрузку Если есть предложения получше при тех же вводных - предлагайте😉 #async

Hashtags

Резултати

Пронајдени 1 слични објави

Пребарај: #riteaid

当前筛选 #riteaid清除筛选
AI & Law

@ai_and_law · Post #200 · 26.12.2023 г., 08:04

FTC bans Rite Aid from using AI facial recognition in stores for 5 years Hello everybody! The US Federal Trade Commission (FTC) has barred American drugstore giant Rite Aid from utilizing AI facial recognition technology for surveillance purposes over the next five years. The FTC intervened as Rite Aid allegedly "failed to implement reasonable procedures" in deploying facial recognition across 200 stores over eight years. Rite Aid's facial recognition system, designed to identify past shoplifters, resulted in numerous false positives. Tens of thousands of individuals were included, often with low-quality images from various sources, leading to unwarranted confrontations and police interventions, disproportionately impacting people of color. Rite Aid is mandated to delete collected images, algorithms, and related products, notify consumers, enhance data security measures, and provide clear notices regarding any biometric surveillance technology in stores. Rite Aid, while agreeing to the FTC settlement, expressed fundamental disagreement with the facial recognition allegations. The company halted the technology's use three years prior to the FTC investigation and commits to fortifying information security practices. #AILaw#PrivacyRights#FacialRecognition#FTC#RiteAid#LegalTech