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, io
from google.cloud import vision
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r"<Cloud Service Token.json>"
client = vision.ImageAnnotatorClient()
def cropHint(file_path, aspect_ratios):
with io.open(file_path, 'rb') as image_file:
content = image_file.read()
from Google import Create_Service
CLIENT_SECRET_FILE = '<client secret.json>'
API_SERVICE_NAME = 'sheets'
API_VERSION = 'v4'
SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
service = Create_Service(CLIENT_SECRET_FILE, API_SERVICE_NAME, API_VERSION, SCOPES)
gsheet_id = '<google sheet id>'
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
x_data = []
y_data = []
fig, ax = plt.subplots()
ax.set_xlim(0, 105)
ax.set_ylim(0, 12)
import sys
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5.QtGui import QPainter, QPixmap, QPen
image_path = r"<image file path>"
class Demo(QWidget):
def __init__(self):
super().__init__()
self.image = QPixmap(image_path)
import os, io
from google.cloud import vision
import pandas as pd
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r"ServiceAccountToken.json"
client = vision.ImageAnnotatorClient()
file_name = 'cable car.jpg'
image_path = f'.\VisionAPI\Images\{file_name}'
import os
import io
from google.cloud import vision
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r'ServiceAccountToken.json'
client = vision.ImageAnnotatorClient()
file_name = 'sunset.jpg'
image_path = f'.\Images\{file_name}'
import sys
from PyQt5.QtWidgets import QApplication, QWidget, QTreeView, QFileSystemModel, QVBoxLayout
from PyQt5.QtCore import QModelIndex
class FileSystemView(QWidget):
def __init__(self, dir_path):
super().__init__()
appWidth = 800
appHeight = 300
self.setWindowTitle('File System Viewer')
import sys
from PyQt5.QtWidgets import QWidget, QApplication, QDial, QLabel, QVBoxLayout
from PyQt5.QtGui import QFont
class Demo(QWidget):
def __init__(self):
super().__init__()
self.setWindowTitle('QDial Demo')
self.setGeometry(300, 300, 500, 500)
import pandas as pd
df1 = pd.DataFrame({ 'colA': [10, 20, 30],
'colB': [100, 200, 300]})
df2 = pd.DataFrame({ 'colA': [40, 20, 50],
'colB': [400, 200, 500]})
new_df = pd.concat([df1, df2]).drop_duplicates().reset_index(drop=True)
print(new_df)
import os, io
from google.cloud import vision
import pandas as pd
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r'ServiceAccountToken.json'
client = vision.ImageAnnotatorClient()
file_name = 'people1.jpg'
image_path = f'.\Images\{file_name}'