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

Резултати

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

Пребарај: #creativerights

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

@ai_and_law · Post #677 · 13.10.2025 г., 07:04

🇺🇸DC Comics Rejects Generative AI in Creative Work DC Comics President and Publisher Jim Lee made a clear statement during New York Comic Con: the company will not support the use of generative AI for storytelling or artwork. “Not now, not ever, as long as Anne DePies and I are in charge,” Lee said, framing AI’s role in creative industries as a passing trend akin to the Millennium bug scare and NFT hype. DC has long required that all its artwork be original and authentically created by artists. Recent backlash over suspected AI use in variant comic covers prompted the company to take an even firmer stance. Lee emphasized that audiences value “what feels authentic,” adding: “AI doesn’t dream. It doesn’t feel. It doesn’t make art. It aggregates it.” #AIEthics#CreativeRights#IPLaw #

The Digi Doodles

@Digi_doodles · Post #624 · 05.08.2025 г., 09:05

Stability AI: Fair Pay for Artists?💐 Prem Akkaraju, CEO of Stability AI, has announced a game-changing commitment: Artists whose work is used to train generative AI models may soon receive compensation — similar to royalties on Spotify. Key points: — Focus on licensed training data — Plans for revenue-sharing models with creators — A move toward ethical and transparent AI development ✉️As debates rage over AI and authorship, Stability AI takes a step toward making tech fairer — and more artist-friendly. #AIArt#StabilityAI#CreativeRights#EthicalAI#ArtAndTech