Skip to content

Instantly share code, notes, and snippets.

View juntao's full-sized avatar

Michael Yuan juntao

View GitHub Profile
@juntao
juntao / main.yml
Created March 23, 2020 15:01
The .github/workflows/main.yml file for Arenztopia.com
name: github pages
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v1 # v2 does not have submodules option now
// Load the model data from a file
let model_data: &[u8] = include_bytes!("lite-model_aiy_vision_classifier_food_V1_1.tflite");
// Read the input image data from Tencent Cloud's API gateway
let mut buffer = String::new();
io::stdin().read_to_string(&mut buffer).expect("Error reading from STDIN");
let obj: FaasInput = serde_json::from_str(&buffer).unwrap();
let img_buf = base64::decode_config(&(obj.body), base64::STANDARD).unwrap();
// Resize the image to the size needed by the Tensorflow model
let labels = include_str!("aiy_food_V1_labelmap.txt");
let mut i = 0;
let mut max_index: i32 = -1;
let mut max_value: u8 = 0;
while i < res_vec.len() {
let cur = res_vec[i];
if cur > max_value {
max_value = cur;
max_index = i as i32;
@juntao
juntao / cuda.md
Last active October 17, 2023 09:19 — forked from dm4/cuda.md
Run WasmEdge WASI-NN plugin on AWS EC2 Instance

Setup CUDA on AWS EC2 Instance

This tutorial is based on this AWS tutorial. In this tutorial, we will install Nvidia driver on AWS EC2 instance and compile and run llama.cpp on it.

Create an AWS EC2 instance

Here we use g5.4xlarge instance with Ubuntu 22.04 AMI, which use Nvidia A10G GPU.

Install Nvidia driver