This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg | |
import tkinter as tk | |
# Sample data for X and Y | |
X = np.random.rand(10, 3) | |
Y = np.random.rand(10, 3) | |
# Create the main window |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dlib_count_faces(image_path): | |
img = Image.open(image_path) | |
img = img.convert('RGB') | |
img_array = np.array(img) | |
detector = dlib.get_frontal_face_detector() | |
faces = detector(img_array) | |
return len(faces) | |
def haar_cascade_count_faces(image_path): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def successful_payment_callback(update: Update, context): | |
col = get_collection() | |
receipt = update.message.successful_payment | |
col.insert_one({"telegram_uid": update.message.chat.username, | |
"donated_amount": receipt.total_amount, | |
"currency": receipt.currency, | |
"datetime": str(datetime.datetime.now())}) | |
print_col(col) | |
update.message.reply_text("Thank you for your purchase!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
def get_collection(): | |
client = pymongo.MongoClient() | |
db = client["database"] | |
col = db["transactions"] | |
return col |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from telegram import LabeledPrice, ParseMode | |
from telegram.ext import PreCheckoutQueryHandler | |
from telegram.ext.callbackcontext import CallbackContext | |
from telegram.ext.commandhandler import CommandHandler | |
from telegram.ext.filters import Filters | |
from telegram.ext.messagehandler import MessageHandler | |
from telegram.ext.updater import Updater | |
from telegram.update import Update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from telegram import LabeledPrice, ParseMode | |
from telegram.ext import PreCheckoutQueryHandler | |
from telegram.ext.callbackcontext import CallbackContext | |
from telegram.ext.commandhandler import CommandHandler | |
from telegram.ext.filters import Filters | |
from telegram.ext.messagehandler import MessageHandler | |
from telegram.ext.updater import Updater | |
from telegram.update import Update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from telegram.ext.callbackcontext import CallbackContext | |
from telegram.ext.commandhandler import CommandHandler | |
from telegram.ext.filters import Filters | |
from telegram.ext.messagehandler import MessageHandler | |
from telegram.ext.updater import Updater | |
from telegram.update import Update | |
BOT_KEY = "<YOUR_BOT_TOKEN_HERE>" |