-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drive web frontend using ontario (#53)
* Drive web frontend using ontario Stop crashes Change default vals Fix upload_image breakage * It works, somewhat
- Loading branch information
Showing
16 changed files
with
601 additions
and
3,339 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ output/ | |
node_modules | ||
lib | ||
build/ | ||
**/__pycache__ | ||
**/__pycache__ |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// GNU AGPL v3 License | ||
// Written by John Nunley and Grace Meredith. | ||
|
||
import { API_URL } from "./consts"; | ||
|
||
import axios from "axios"; | ||
|
||
const API = axios.create({ | ||
baseURL: API_URL, | ||
timeout: 10000, | ||
}); | ||
|
||
export function uploadImage(file: File): Promise<number> { | ||
const formData = new FormData(); | ||
formData.append("image", file); | ||
|
||
// Response will be JSON with number field "id" | ||
return API.post("/upload_image", formData, { responseType: "json" }).then( | ||
(response) => response.data.id | ||
); | ||
} | ||
|
||
export function processPipeline(pipeline: any): Promise<File> { | ||
// The body of the returning request will be an image file. | ||
return API.post( | ||
"/process", | ||
pipeline, | ||
{ responseType: "blob" } | ||
).then((response) => response.data); | ||
} |
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// GNU AGPL v3 License | ||
|
||
// This file in its entirety was written by John Nunley and Grace Meredith. | ||
|
||
export const API_URL = "/api/"; |
Oops, something went wrong.