Skip to content

Instantly share code, notes, and snippets.

View pemagrg1's full-sized avatar
:octocat:
working...

Pema Gurung pemagrg1

:octocat:
working...
View GitHub Profile
@pemagrg1
pemagrg1 / textonimage.py
Created February 24, 2022 11:58
Adding text on multiple images. (Can be used specially for invitation cards)
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
names = ["Pema", "Gurung", "Pema Gurung"]
for name in names:
myFont = ImageFont.truetype(
'/Downloads/precious/Precious.ttf', 65)
"""
Github Source: https://github.com/unitaryai/detoxify
saving a glimpse of https://www.section.io/engineering-education/building-a-toxicity-classifier/
Toxicity detection using Detoxify
pip install detoxify
"""
from detoxify import Detoxify
predictor = Detoxify('multilingual')
print(predictor.predict('Why are you so fat?'))
@pemagrg1
pemagrg1 / convert_envyml_to_reqtxt
Created April 22, 2020 17:51
convert environment.yml to requirement.txt
import ruamel.yaml
yaml = ruamel.yaml.YAML()
data = yaml.load(open('environment.yml'))
requirements = []
for dep in data['dependencies']:
if isinstance(dep, str):
package, package_version, python_version = dep.split('=')
if python_version == '0':