Python | Machine Learning | Coding | R
62.3K subscribers
1.13K photos
67 videos
141 files
778 links
List of our channels:
https://t.me/addlist/8_rRW2scgfRhOTc0

Discover powerful insights with Python, Machine Learning, Coding, and Rβ€”your essential toolkit for data-driven solutions, smart alg

Help and ads: @hussein_sheikho

https://telega.io/?r=nikapsOH
Download Telegram
Python | Machine Learning | Coding | R
πŸ–₯ Text-to-Speech with PyTorch https://t.me/CodeProgrammer
πŸ–₯ Text-to-Speech with PyTorch

import torchaudio
import torch
import matplotlib.pyplot as plt
import IPython.display

bundle = torchaudio.pipelines.TACOTRON2_WAVERNN_PHONE_LJSPEECH

processor = bundle.get_text_processor()
tacotron2 = bundle.get_tacotron2().to(device) # Move model to the desired device
vocoder = bundle.get_vocoder().to(device) # Move model to the desired device

text = " My first text to speech!"

with torch.inference_mode():
processed, lengths = processor(text)
processed = processed.to(device) # Move processed text data to the device
lengths = lengths.to(device) # Move lengths data to the device
spec, spec_lengths, _ = tacotron2.infer(processed, lengths)
waveforms, lengths = vocoder(spec, spec_lengths)


fig, [ax1, ax2] = plt.subplots(2, 1, figsize=(16, 9))
ax1.imshow(spec[0].cpu().detach(), origin="lower", aspect="auto") # Display the generated spectrogram
ax2.plot(waveforms[0].cpu().detach()) # Display the generated waveform7. Play the generated audio using IPython.display.Audio
IPython.display.Audio(waveforms[0:1].cpu(), rate=vocoder.sample_rate)

https://t.me/CodeProgrammer
Best-of Python

πŸ† A ranked list of awesome Python open-source libraries & tools. Updated weekly.

β–ͺ Github: https://github.com/ml-tooling/best-of-python

https://t.me/CodeProgrammer
More reaction. please β­οΈπŸ’β­οΈ
πŸ–₯ 5 useful Python automation scripts

1. Download Youtube videos
pip install pytube

from pytube import YouTube

# Specify the URL of the YouTube video
video_url = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

# Create a YouTube object
yt = YouTube(video_url)

# Select the highest resolution stream
stream = yt.streams.get_highest_resolution()

# Define the output path for the downloaded video
output_path = "path/to/output/directory/"

# Download the video
stream.download(output_path)

print("Video downloaded successfully!")


2. Automate WhatsApp messages

pip install pywhatkit

import pywhatkit

# Set the target phone number (with country code) and the message
phone_number = "+1234567890"
message = "Hello, this is an automated WhatsApp message!"

# Schedule the message to be sent at a specific time (24-hour format)
hour = 13
minute = 30

# Send the scheduled message
pywhatkit.sendwhatmsg(phone_number, message, hour, minute)

3. Google search with Python

pip install googlesearch-python


from googlesearch import search

# Define the query you want to search
query = "Python programming"

# Specify the number of search results you want to retrieve
num_results = 5

# Perform the search and retrieve the results
search_results = search(query, num_results=num_results, lang='en')

# Print the search results
for result in search_results:
print(result)

4. Download Instagram posts

pip install instaloader

import instaloader

# Create an instance of Instaloader
loader = instaloader.Instaloader()

# Define the target Instagram profile
target_profile = "instagram"

# Download posts from the profile
loader.download_profile(target_profile, profile_pic=False, fast_update=True)

print("Posts downloaded successfully!")


5. Extract audio from video files

pip install moviepy

from moviepy.editor import VideoFileClip

# Define the path to the video file
video_path = "path/to/video/file.mp4"

# Create a VideoFileClip object
video_clip = VideoFileClip(video_path)

# Extract the audio from the video
audio_clip = video_clip.audio

# Define the output audio file path
output_audio_path = "path/to/output/audio/file.mp3"

# Write the audio to the output file
audio_clip.write_audiofile(output_audio_path)

# Close the clips
video_clip.close()
audio_clip.close()

print("Audio extracted successfully!")


https://t.me/CodeProgrammer
πŸ”­ Daily Useful Scripts

Daily.py is a repository that provides a collection of ready-to-use Python scripts for automating common daily tasks.

git clone https://github.com/Chamepp/Daily.py.git

β–ͺ Github: https://github.com/Chamepp/Daily.py

https://t.me/CodeProgrammer
Introduction to Python

Learn fundamental concepts for Python beginners that will help you get started on your journey to learn Python. These tutorials focus on the absolutely essential things you need to know about Python.

What You’ll Learn:
β€’ Installing a Python environment
β€’ The basics of the Python language

https://realpython.com/learning-paths/python3-introduction/

https://t.me/CodeProgrammer
Flask by Example

You’re going to start building a Flask app that calculates word-frequency pairs based on the text from a given URL. This is a full-stack tutorial covering a number of web development techniques. Jump right in and discover the basics of Python web development with the Flask microframework.

https://realpython.com/learning-paths/flask-by-example/

https://t.me/CodeProgrammer
πŸ‘β€πŸ—¨ Running YOLOv7 algorithm on your webcam using Ikomia API
Python | Machine Learning | Coding | R
πŸ‘β€πŸ—¨ Running YOLOv7 algorithm on your webcam using Ikomia API
πŸ‘β€πŸ—¨ Running YOLOv7 algorithm on your webcam using Ikomia API

from ikomia.dataprocess.workflow import Workflow
from ikomia.utils import ik
from ikomia.utils.displayIO import display
import cv2

stream = cv2.VideoCapture(0)

# Init the workflow
wf = Workflow()

# Add color conversion
cvt = wf.add_task(ik.ocv_color_conversion(code=str(cv2.COLOR_BGR2RGB)), auto_connect=True)

# Add YOLOv7 detection
yolo = wf.add_task(ik.infer_yolo_v7(conf_thres="0.7"), auto_connect=True)

while True:
ret, frame = stream.read()

# Test if streaming is OK
if not ret:
continue

# Run workflow on image
wf.run_on(frame)

# Display results from "yolo"
display(
yolo.get_image_with_graphics(),
title="Object Detection - press 'q' to quit",
viewer="opencv"
)

# Press 'q' to quit the streaming process
if cv2.waitKey(1) & 0xFF == ord('q'):
break

# After the loop release the stream object
stream.release()

# Destroy all windows
cv2.destroyAllWindows()


https://t.me/CodeProgrammer
πŸ–₯ Generate API docs under a minute in Django

https://t.me/CodeProgrammer
This media is not supported in your browser
VIEW IN TELEGRAM
πŸ‘Savant: Supercharged Computer Vision and Video Analytics Framework on DeepStream

git clone https://github.com/insight-platform/Savant.git

cd Savant/samples/peoplenet_detector

git lfs pull


β–ͺGithub: https://github.com/insight-platform/Savant

https://t.me/CodeProgrammer
πŸ–₯ Convert PDF to docx using Python

β–ͺGithub: https://github.com/dothinking/pdf2docx

https://t.me/CodeProgrammer

Please more reaction with our posts
ML_cheatsheets.pdf
6.5 MB
Machine Learning cheatsheet (very important)

https://t.me/CodeProgrammer

Please more reaction with our posts