-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update 0.10.0 docs & refactor docs structure #167
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
91be087
nits: adjust color themes & add logo,faivicon
furiosamg 1361ce7
docs: add mkdocs-jupyter
furiosamg a68f1e8
ci: test docs notebooks too
furiosamg 4d2b306
fix: replace `Mode.load[_async]()`, `use_native`, `.source` in docs
hyeonu-furiosa bbc1fcc
fix: replace `calib_range` in docs
hyeonu-furiosa d135619
apply review
hyeonu-furiosa ccdf31a
nits: isort & run jupyter test in ci
furiosamg 67c6de4
docs: update changelog & docs
furiosamg b0c0074
ci: loosen nbmake timeout
furiosamg 66470fa
docs: add serving example
furiosamg 5458dac
docs: trim ws/newline in ver when releasing docs
furiosamg 41369c1
ci: bump version up to 0.10.0
furiosamg add3e67
nits: import early, packaging stuffs correctly
furiosamg 9eb8d4a
docs: apply changes from 0.10.0 update
furiosamg e159b9f
ci: fix fnp version
furiosamg f771d98
Apply simple review comments
furiosamg 100f66a
docs: add details about quantize, & serving
furiosamg c1aca86
docs: Capitalize documentations' titles
furiosamg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,45 @@ | ||
from tempfile import NamedTemporaryFile | ||
from typing import Dict, List | ||
|
||
from fastapi import FastAPI, File, UploadFile | ||
import numpy as np | ||
import uvicorn | ||
|
||
from furiosa.common.thread import synchronous | ||
from furiosa.models import vision | ||
from furiosa.serving import ServeAPI, ServeModel | ||
|
||
serve = ServeAPI() | ||
app: FastAPI = serve.app | ||
|
||
resnet50 = vision.ResNet50() | ||
# ServeModel does not support in-memory model binary for now, | ||
# so we write model into temp file and pass its path | ||
model_file = NamedTemporaryFile() | ||
model_file.write(resnet50.model_source()) | ||
model_file_path = model_file.name | ||
|
||
model: ServeModel = synchronous(serve.model("furiosart"))('ResNet50', location=model_file_path) | ||
|
||
|
||
@model.post("/infer") | ||
async def infer(image: UploadFile = File(...)) -> Dict[str, str]: | ||
# Model Zoo's preprocesses do not consider in-memory image file for now | ||
# (note that it's different from in-memory tensor) | ||
# so we write in-memory image into temp file and pass its path | ||
image_file_path = NamedTemporaryFile() | ||
image_file_path.write(await image.read()) | ||
|
||
tensors, _ctx = resnet50.preprocess(image_file_path.name) | ||
|
||
# Infer from ServeModel | ||
result: List[np.ndarray] = await model.predict(tensors) | ||
|
||
response: str = resnet50.postprocess(result) | ||
|
||
return {"result": response} | ||
|
||
|
||
# Run the server if current Python script is called directly | ||
if __name__ == "__main__": | ||
uvicorn.run(app, host="0.0.0.0", port=8000) |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This update was necessary. This part looks great.