Skip to content

Instantly share code, notes, and snippets.

View DataSolveProblems's full-sized avatar
💭
Github Working In Progress

Jie Jenn DataSolveProblems

💭
Github Working In Progress
View GitHub Profile
import os
from Google import Create_Service
import pandas as pd
working_dir = r'<>'
output_dir = os.path.join(working_dir, 'Output')
CLIENT_SECRET_FILE = r"client_secret.json"
API_SERVICE_NAME = 'drive'
API_VERSION = 'v3'
import io, os
from google.cloud import vision
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r"GoogleCloudDemo_ServiceAcct_Token.json"
client = vision.ImageAnnotatorClient()
file_name = 'cat.jpg'
image_path = os.path.join('.\images', file_name)
with io.open(image_path, 'rb') as image_file:
import io, os
from numpy import random
from google.cloud import vision
from Pillow_Utility import draw_borders, Image
import pandas as pd
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r"GoogleCloudDemo_ServiceAcct_Token.json"
client = vision.ImageAnnotatorClient()
file_name = 'ikea3.jpg'
from PIL import Image, ImageDraw, Image, ImageFont
"""
To install the Pillow library
pip install Pillow
"""
def draw_borders(pillow_image, bounding, color, image_size, caption='', confidence_score=0):
width, height = image_size
draw = ImageDraw.Draw(pillow_image)
import os, io
from draw_vertice import drawVertices
from google.cloud import vision
import pandas as pd
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r'ServiceAccountToken.json'
client = vision.ImageAnnotatorClient()
file_name = 'test.jpg'
image_folder = './images/'
import io
from PIL import Image, ImageDraw, ImageFont
def drawVertices(image_source, vertices, display_text=''):
pillow_img = Image.open(io.BytesIO(image_source))
draw = ImageDraw.Draw(pillow_img)
for i in range(len(vertices) - 1):
draw.line(((vertices[i].x, vertices[i].y), (vertices[i + 1].x, vertices[i + 1].y)),
fill='green',
import os
import io
from google.cloud import vision
import pandas as pd
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r"GoogleCloudDemo.json"
client = vision.ImageAnnotatorClient()
file_name = 'Chicago.jpg'
import os
import io
from google.cloud import vision_v1
import pandas as pd
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r'ServiceAccountToken.json'
client = vision_v1.ImageAnnotatorClient()
def detect_landmark(file_path):
try:
import os, sys
import argparse
"""
Images uploaded with APIPrice per unit
First 500 images per monthfree
Next 9 500 image compressions $0.009 per image
After 10 000 image compressions$0.002 per image
Sub PrintActiveSheet()
Dim ws As Worksheet: Set ws = ThisWorkbook.ActiveSheet
With ws.PageSetup
.Orientation = xlLandscape
.Zoom = False
.FitToPagesTall = 1
.FitToPagesWide = 1
.PrintArea = "B1:R41"