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
package com.johnolafenwa.pytorchandroid; | |
public class Constants { | |
public static String[] IMAGENET_CLASSES = new String[]{ | |
"tench, Tinca tinca", | |
"goldfish, Carassius auratus", | |
"great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias", | |
"tiger shark, Galeocerdo cuvieri", | |
"hammerhead, hammerhead shark", |
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
package com.johnolafenwa.pytorchandroid; | |
import android.graphics.Bitmap; | |
import org.pytorch.Tensor; | |
import org.pytorch.Module; | |
import org.pytorch.IValue; | |
import org.pytorch.torchvision.TensorImageUtils; | |
public class Classifier { |
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
apply plugin: 'com.android.application' | |
android { | |
compileSdkVersion 28 | |
defaultConfig { | |
applicationId "com.johnolafenwa.pytorchandroid" | |
minSdkVersion 21 | |
targetSdkVersion 28 | |
versionCode 1 | |
versionName "1.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
import torch | |
from torchvision.models import mobilenet_v2 | |
model = mobilenet_v2(pretrained=True) | |
model.eval() | |
input_tensor = torch.rand(1,3,224,224) | |
script_model = torch.jit.trace(model,input_tensor) | |
script_model.save("mobilenet-v2.pt") |
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
version: '3.1' | |
services: | |
db: | |
image: postgres | |
restart: always | |
environment: | |
POSTGRES_USER: john | |
POSTGRES_PASSWORD: example | |
POSTGRES_DB: endgame |
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 Flask,request,render_template,redirect | |
import psycopg2 | |
import os | |
import time | |
DB_USER = os.environ["DB_USER"] | |
DB_PASSWORD = os.environ["DB_PASS"] | |
DB = os.environ["DB"] | |
DB_HOST = os.environ["DB_HOST"] |
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 Flask,request,render_template,redirect | |
import requests | |
import os | |
class Review(object): | |
def __init__(self,name,review): | |
self.name = name | |
self.review = review | |
app = Flask(__name__) |
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 Flask,request,render_template,redirect | |
import sqlite3 | |
import os | |
class Review(object): | |
def __init__(self,name,review): | |
self.name = name | |
self.review = review | |
DATA_PATH = "/database" |
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 Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def index(): | |
return """<h1>Hello From Flask</h1> | |
<h2> Version Three of Dockerland </h2>""" |
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 Flask | |
app = Flask(__name__) | |
@app.route("/") | |
def index(): | |
return """<h1>Hello From Flask</h1> | |
<h2> This is the Second Version of Dockerland </h2>""" |