Python/ django
59K subscribers
2.08K photos
62 videos
47 files
2.8K links
по всем вопросам @haarrp

@itchannels_telegram - 🔥 все ит-каналы

@ai_machinelearning_big_data -ML

@ArtificialIntelligencedl -AI

@datascienceiot - 📚

@pythonlbooks

РКН: clck.ru/3FmxmM
加入频道
🎁 #Django 5.0 RC 1 is out.

Вышел Django 5.0 RC 1:

https://djangoproject.com/weblog/2023/nov/20/django-50-rc1/

Это последний шанс протестировать его перед финальным релизом, который ожидается в начале декабря.

@pythonl
This media is not supported in your browser
VIEW IN TELEGRAM
🔥 flowty-realtime-lcm-canvas

A realtime sketch to image demo using LCM and the gradio library.

Преобразование наброска в изображение в реальном времени с использованием LCM и библиотеки gradio.

Github

@pythonl
This media is not supported in your browser
VIEW IN TELEGRAM
🖥 Jupyter ❤️ Textual

Create Jupyter widgets in pure Python.

Создание виджетов Jupyter на чистом Python, без использования JavaScript!

pip install ipytextual

Github

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 Define categories with the Enum Python module and use auto() for automatic numbering.

Классы Enum в #Python делают ваш код более читабельным! Определите категории с помощью модуля Enum Python и используйте auto() для автоматической нумерации.

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 Эти фишки реально ускорят Python код! Numba+ Taichi+ С

https://www.youtube.com/watch?v=b7BFQB2MF2w

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 ZipLoRA-pytorch

ZipLoRA: Any Subject in Any Style by Effectively Merging LoRAs

Напарвление любой генерации в любом стиле путем эффективного слияния в LoRA.

Github

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 The easiest way to 10x your development environment:

Start managing experiments, logging prompts, and tracking your code.


Самый простой способ улучшения среды разработки:

Начните управлять тестами, регистрировать подсказки и отслеживать свой код.

Вы можете сделать все sэто бесплатно, используя такой инструмент, как Cometml, с помощью пары строк кода.

Посмотрите на прилагаемый скриншот:

Интеграция Comet + OpenAI будет отслеживать все автоматически:

- сообщения и function_call как входы
- варианты как выходы
- токен использования как метаданные
- работми с метаданными

pip install comet_llm

Этот блокнот Colab продемонстрирует вам пример работы Cometml:
https://colab.research.google.com/github/comet-ml/comet-examples/blob/master/integrations/llm/openai/notebooks/Comet_and_OpenAI.ipynb#scrollTo=A0-thQauBRRL

Github

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥Security of data storage in Python

We recommend storing sensitive information in an .env file and loading it into a Python script using python-dotenv.

🔒Безопасность хранения данных в Python🔒


Рекомендуется хранить конфиденциальную информацию в файле .env и загружать ее в сценарий Python с помощью python-dotenv.

Это позволяет защитить информацию от раскрытия в кодовой базе или системах контроля версий.

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
Please open Telegram to view this post
VIEW IN TELEGRAM
🎞 Pytube is a lightweight #Python library that enables you to download #YouTube videos and playlists in specific formats and resolutions.

pytube - это быстрая библиотека #Python, которая позволяет скачивать видео и плейлисты #YouTube в определенных форматах и разрешениях.

Github

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
GAOJGY8XMAAiqAQ.jpeg
706.7 KB
💥 Here is an amazing Python cheat sheet for you all!

Объемная шпаргалка по Python по всем основным темам.

@pythonl
🦾 nrich

A command-line tool to quickly analyze all IPs in a file and see which ones have open ports/ vulnerabilities.

Инструмент командной строки, позволяющий быстро проанализировать все IP-адреса в файле и увидеть, какие из них имеют открытые порты/уязвимости. Также может передавать данные из stdin для использования в конвейере данных.

wget https://gitlab.com/api/v4/projects/33695681/packages/generic/nrich/latest/nrich_latest_x86_64.deb
$ sudo dpkg -i nrich_latest_x86_64.deb


GIthub

@pythonl
🖥 Public APIs

A collective list of free APIs for use in software and web development

Огромный список бесплатных API для использования в программном обеспечении и веб-разработке.

Github

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 Python module to get stock data/cryptocurrencies from the Alpha Vantage API.

Python-модуль для получения данных о акциях/криптовалютах из API Alpha Vantage

Бесплатный API для получения финансовых данных и индикаторов в реальном времени.

pip install alpha_vantage

from alpha_vantage.timeseries import TimeSeries
import matplotlib.pyplot as plt

ts = TimeSeries(key='YOUR_API_KEY', output_format='pandas')
data, meta_data = ts.get_intraday(symbol='MSFT',interval='1min', outputsize='full')
data['4. close'].plot()
plt.title('Intraday Times Series for the MSFT stock (1 min)')
plt.show()

Github

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 SQLModel 0.0.14 with support for pydantic v2 🚀

SQLModel 0.0.14 с поддержкой pydantic v2 🎉
Уверен, что это самый большой релиз за все время 🤓.

SQLModel - это библиотека для взаимодействия с базами данных SQL из кода Python, с объектами Python. Она создана для того, чтобы быть интуитивно понятной, простой в использовании, хорошо совместимой и надежной.

$ pip install sqlmodel

Github

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
🎉 Django 5.0 released

Команда Django выпустила Django 5.0.

https://www.djangoproject.com/weblog/2023/dec/04/django-50-released/

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
💼 QuantStats Python library that performs portfolio profiling

"Библиотека QuantStats на языке Python, которая выполняет расчет портфеля, позволяя инвесторам и портфельным менеджерам лучше понимать свою работу, предоставляя им углубленную аналитику и метрики риска."

%matplotlib inline
import quantstats as qs

# extend pandas functionality with metrics, etc.
qs.extend_pandas()

# fetch the daily returns for a stock
stock = qs.utils.download_returns('META')

# show sharpe ratio
qs.stats.sharpe(stock)

# or using extend_pandas() :)
stock.sharpe()

Github

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
carbon.png
601.4 KB
🖥 The code for building an OpenCV Python security camera.

Код для управление камеры безопасности на OpenCV Python.

import cv2
import time
import datetime

cap = cv2.VideoCapture(0)

face_cascade = cv2.CascadeClassifier(
cv2.data.haarcascades + "haarcascade_frontalface_default.xml")
body_cascade = cv2.CascadeClassifier(
cv2.data.haarcascades + "haarcascade_fullbody.xml")

detection = False
detection_stopped_time = None
timer_started = False
SECONDS_TO_RECORD_AFTER_DETECTION = 5

frame_size = (int(cap.get(3)), int(cap.get(4)))
fourcc = cv2.VideoWriter_fourcc(*"mp4v")

while True:
_, frame = cap.read()

gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
faces = face_cascade.detectMultiScale(gray, 1.3, 5)
bodies = face_cascade.detectMultiScale(gray, 1.3, 5)

if len(faces) + len(bodies) > 0:
if detection:
timer_started = False
else:
detection = True
current_time = datetime.datetime.now().strftime("%d-%m-%Y-%H-%M-%S")
out = cv2.VideoWriter(
f"{current_time}.mp4", fourcc, 20, frame_size)
print("Started Recording!")
elif detection:
if timer_started:
if time.time() - detection_stopped_time >= SECONDS_TO_RECORD_AFTER_DETECTION:
detection = False
timer_started = False
out.release()
print('Stop Recording!')
else:
timer_started = True
detection_stopped_time = time.time()

if detection:
out.write(frame)

# for (x, y, width, height) in faces:
# cv2.rectangle(frame, (x, y), (x + width, y + height), (255, 0, 0), 3)

cv2.imshow("Camera", frame)

if cv2.waitKey(1) == ord('q'):
break

out.release()
cap.release()
cv2.destroyAllWindows()

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 Calculate derivatives in Python

Вычисление производных на Python.

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM
🖥 A lesser-known case in a lesser-known function in the standard library, `itertools.groupby()` (not the `pandas` version!)

Параметр `key` чаще всего встречается в `sorted()` и `.sort()` или `max()` и `min()`, но он встречается и в других функциях.

Вот менее известный случай в менее известной функции из стандартной библиотеки, `itertools.groupby()` (не pandas!)

@pythonl
Please open Telegram to view this post
VIEW IN TELEGRAM