Skip to content

Instantly share code, notes, and snippets.

View liuhh02's full-sized avatar
🧑‍🎓

Liu Haohui liuhh02

🧑‍🎓
View GitHub Profile
@liuhh02
liuhh02 / herokutelegrambot.py
Last active October 4, 2021 10:57
Starter python code for deploying telegram bot with heroku using the library python-telegram-bot
"""
Simple Bot to reply to Telegram messages taken from the python-telegram-bot examples.
Deployed using heroku.
Author: liuhh02 https://medium.com/@liuhh02
"""
import logging
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
import os
@liuhh02
liuhh02 / pythontelegrambot.py
Last active March 17, 2022 16:40
Starter python code for a telegram bot using the library python-telegram-bot
"""
Simple Bot to reply to Telegram messages taken from the python-telegram-bot examples.
Source: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/examples/echobot2.py
"""
import logging
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
# Enable logging
@liuhh02
liuhh02 / telegrambot.py
Last active March 15, 2021 15:15
Starter code to create a telegram bot using the python-telegram-bot library.
"""
telegrambot.py
Starter code to create a telegram bot using the python-telegram-bot library.
Includes call to Google Maps API to extract map coordinates from location.
Author: liuhh02 https://medium.com/@liuhh02
"""
import logging
import telegram
@liuhh02
liuhh02 / scale_images.py
Last active June 22, 2024 12:56
Function to scale any image to the pixel values of [-1, 1] for GAN input
"""
scale_images.py
Function to scale any image to the pixel values of [-1, 1] for GAN input.
Author: liuhh02 https://machinelearningtutorials.weebly.com/
"""
from PIL import Image
import numpy as np
from os import listdir
@liuhh02
liuhh02 / num_channels.py
Last active June 30, 2023 15:51
Find number of channels in your image
"""
num_channels.py
Find number of channels in your image.
Author: liuhh02 https://machinelearningtutorials.weebly.com/
"""
from PIL import Image
import numpy as np
@liuhh02
liuhh02 / pix2pix_combine.py
Last active November 22, 2019 10:37
Combine 2 images from different domains for pix2pix
"""
pix2pix_combine
Combine 2 images from different domains for pix2pix. Make sure images in folderA and folderB have the same name.
Folder Structure:
folderA
|--> train
|--> valid (if any)
|--> test (if any)
folderB
|--> train
@liuhh02
liuhh02 / tif_to_nii.py
Last active January 11, 2023 14:00
Convert multiple tiff images in a directory to a single 3D nifti file
"""
tif_to_nii
Convert multiple tiff images in a directory to a single 3D nifti file.
Naming Convention: root001_01 - root001_100, root002_01 - root002_100, ...
Usage instructions: change the source path (src_path) [represents the path to your tiff images],
destination path (dest_path) [represents the path you want to store your 3D nifti file in] and bases
[this represents the name of the files] accordingly
Author: liuhh02 https://machinelearningtutorials.weebly.com/