This file contains 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
# Create a service account and associate a "Vertex AI User" role | |
import google.auth | |
import google.auth.transport.requests | |
from google.oauth2 import service_account | |
import vertexai | |
from vertexai.preview.language_models import TextGenerationModel | |
key_path = "<YOUR_KEY_PATH>" | |
credentials = service_account.Credentials.from_service_account_file(key_path,scopes=['https://www.googleapis.com/auth/cloud-platform']) | |
auth_req = google.auth.transport.requests.Request() | |
credentials.refresh(auth_req) |
This file contains 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 pandas as pd | |
import numpy as np | |
import matplotlib | |
import matplotlib.pyplot as plt | |
from matplotlib.backends.backend_pdf import PdfPages | |
import os, time | |
from os import path | |
from google.cloud import storage | |
import re |
This file contains 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 pandas as pd | |
import numpy as np | |
import matplotlib | |
import matplotlib.pyplot as plt | |
from matplotlib.backends.backend_pdf import PdfPages | |
import os, time | |
from os import path | |
from google.cloud import storage | |
import re |
This file contains 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 pandas as pd | |
import numpy as np | |
import matplotlib | |
import matplotlib.pyplot as plt | |
from matplotlib.backends.backend_pdf import PdfPages | |
import os, time | |
from os import path | |
from google.cloud import storage | |
import re |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | |
<link rel="preconnect" href="https://fonts.googleapis.com"> | |
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> |
This file contains 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
doctype html | |
html(lang="en") | |
head | |
title Static Files | |
meta(charset='utf-8') | |
link(rel="stylesheet", href="/static/main.css") | |
body | |
p=content | |
img(src="#{publicUrl}") |
This file contains 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
doctype html | |
html(lang="en") | |
head | |
title Static Files | |
meta(charset='utf-8') | |
link(rel="stylesheet", href="/static/main.css") | |
body | |
form(method="POST", action="/upload", enctype="multipart/form-data") | |
input(type="file", name="file") | |
input(type="submit") |
This file contains 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
{ | |
"name": "appengine-storage", | |
"description": "Node.js Google Cloud Storage sample for Google App Engine", | |
"scripts": { | |
"start": "node app.js", | |
"test": "mocha system-test/*.test.js --exit --timeout=30000" | |
}, | |
"engines": { | |
"node": ">= 12.20.0" | |
}, |
This file contains 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
'use strict'; | |
const process = require('process'); // Required to mock environment variables | |
// [START gae_flex_storage_app] | |
const {format} = require('util'); | |
const express = require('express'); | |
const Multer = require('multer'); | |
const axios = require('axios'); | |
// By default, the client will authenticate using the service account file |
This file contains 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 flask import escape | |
from flask import jsonify | |
def hello_http(request): | |
request_json = request.get_json(silent=True) | |
request_args = request.args | |
if request_json and 'image' in request_json: | |
res = detect_handwritten_ocr_uri(request_json['image']) | |
else: | |
res = "Error in payload data. Attach image" |
NewerOlder