""" Program for getting text from meme. """ import vendor vendor.add("lib") import sys import requests import pytesseract from PIL import Image from StringIO import StringIO """ Convert the image to black and white to make the white text stand out more. This usually helps with extracting the text since the text is usually white. """ def darken_background(img, limit=255): img = img.convert('L') # Create lookup table of rgb values img = img.point(lambda x: 0 if x < limit else 255, '1') # Change each point return img """ Get the image from the url """
""" Program for getting text from meme. """ import vendor vendor.add("lib") import sys import requests import pytesseract from PIL import Image from StringIO import StringIO """ Convert the image to black and white to make the white text stand out more. This usually helps with extracting the text since the text is usually white. """ def darken_background(img, limit=255): img = img.convert('L') # Create lookup table of rgb values img = img.point(lambda x: 0 if x<limit else 255, '1') # Change each point return img """ Get the image from the url """ def get_image(url, darken=True):
import vendor vendor.add('venv/lib/python2.7/site-packages')
"""`appengine_config` gets loaded when starting a new application instance.""" import vendor # insert `lib` as a site directory so our `main` module can load # third-party libraries, and override built-ins with newer # versions. vendor.add('lib') vendor.add('pykml')
# Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # [START vendor] # from google.appengine.ext import vendor import vendor vendor.add('lib') vendor.add('appscalehelper') vendor.add('sparqlwrapper') vendor.add('virtuoso') # [END vendor]
# -*- coding: utf-8 -*- """`appengine_config` gets loaded when starting a new application instance.""" import os import vendor # insert `lib` as a site directory so our `main` module can load # third-party libraries, and override built-ins with newer # versions. vendor.add('../lib') def webapp_add_wsgi_middleware(app): import gae_mini_profiler.profiler app = gae_mini_profiler.profiler.ProfilerWSGIMiddleware(app) return app def gae_mini_profiler_should_profile_production(): pass from google.appengine.api import users return users.is_current_user_admin() def gae_mini_profiler_should_profile_development(): pass # return True # authentication fix for appcfg download_data and upload_data if os.environ.get('SERVER_SOFTWARE', '').startswith('Development'): remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = ('REMOTE_ADDR', ['127.0.0.1'])
import os import vendor ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) vendor.add(os.path.join(ROOT_DIR, 'lib'))
"""`appengine_config` gets loaded when starting a new application instance.""" import vendor # insert `lib` as a site directory so our `main` module can load # third-party libraries, and override built-ins with newer # versions. vendor.add('lib') vendor.add('server')
"""`appengine_config` gets loaded when starting a new application instance.""" import vendor # insert `lib` as a site directory so our `main` module can load # third-party libraries, and override built-ins with newer # versions. vendor.add('lib') vendor.add('lib/bottle-0.11.6') vendor.add('lib/jinja2-2.7.3') vendor.add('lib/oauthlib') vendor.add('lib/requests') vendor.add('lib/requests_oauthlib') vendor.add('lib/appengine_oauth')
"""`appengine_config` gets loaded when starting a new application instance.""" import vendor # insert `vendor` as a site directory so our `main` module can load # third-party libraries, and override built-ins with newer # versions. vendor.add('vendor') def webapp_add_wsgi_middleware(app): from google.appengine.ext.appstats import recording app = recording.appstats_wsgi_middleware(app) return app
#!/usr/bin/python # # Copyright 2017 Google, Inc # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """`appengine_config` gets loaded when starting a new application instance.""" import vendor # insert `third_party` as a site directory so our `main` module can load # third-party libraries, and override built-ins with newer # versions. vendor.add('third_party')
import vendor vendor.add('libs') from websoc_app import * from Course import FIELDNAMES FIELDNAMES = ['last_updated'] + FIELDNAMES import tornado.ioloop import tornado.web import tornado.websocket import tornado.concurrent import tornado.httpclient import sqlite3 import json import time SOCKETS = {'UserData': [], 'Main': []} def _execute(query): """Function to execute queries against a local sqlite database""" dbPath = SQLITE_DIRECTORY + WEBSOC_TERM + '.db' connection = sqlite3.connect(dbPath) connection.row_factory = sqlite3.Row cursorobj = connection.cursor() try: cursorobj.execute(query) result = cursorobj.fetchall() connection.commit() except Exception:
import vendor vendor.add('libs') from websoc_app import * from Course import FIELDNAMES FIELDNAMES = ['last_updated'] + FIELDNAMES import tornado.ioloop import tornado.web import tornado.websocket import tornado.concurrent import tornado.httpclient import sqlite3 import json import time SOCKETS = { 'UserData': [], 'Main': [] } def _execute(query): """Function to execute queries against a local sqlite database""" dbPath = SQLITE_DIRECTORY + WEBSOC_TERM + '.db' connection = sqlite3.connect(dbPath) connection.row_factory = sqlite3.Row cursorobj = connection.cursor() try: cursorobj.execute(query) result = cursorobj.fetchall() connection.commit() except Exception:
"""`appengine_config` gets loaded when starting a new application instance.""" import vendor remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = ('HTTP_X_APPENGINE_INBOUND_APPID',['inversiones-va']) # insert `lib` as a site directory so our `main` module can load # third-party libraries, and override built-ins with newer # versions. vendor.add('lib')
"""`appengine_config` gets loaded when starting a new application instance.""" import vendor import os # insert `lib` as a site directory so our `main` module can load # third-party libraries, and override built-ins with newer # versions. vendor.add('lib') vendor.add('views') # Workaround the dev-environment SSL # http://stackoverflow.com/q/16192916/893652 if os.environ.get('SERVER_SOFTWARE', '').startswith('Development'): import imp import os.path from google.appengine.tools.devappserver2.python import sandbox sandbox._WHITE_LIST_C_MODULES += ['_ssl', '_socket'] # Use the system socket. psocket = os.path.join(os.path.dirname(os.__file__), 'socket.py') imp.load_source('socket', psocket)
# Copyright 2015 Mark Spurgeon """`appengine_config` gets loaded when starting a new application instance.""" import vendor # insert `lib` as a site directory so our `main` module can load # third-party libraries, and override built-ins with newer # versions. vendor.add('lib') remoteapi_CUSTOM_ENVIRONMENT_AUTHENTICATION = ( 'HTTP_X_APPENGINE_INBOUND_APPID', ['startpage-1072'])
import vendor vendor.add('lib') vendor.add('models')