We'll build a ML Classification application with Gramex.
The workshop content is prepared for 1.5 hrs.
Section | Content | Duration |
---|---|---|
Introduction | Gramex intro, controlling data with URL params | 20 mins |
Build an ML app | Use snippets and build the application step-by-step | 50 mins |
Q&A, Support | Q&A session, help the participants | 10 mins |
Possibilities | Other ML applications, Email alerts, Charts, SMS, Screenshots, Admin module | 10 mins |
- you've installed Gramex correctly. If you've noticed any errors please share now.
- you're familiar with ML and would like to build web apps easily.
- construct a simple app with building blocks (
HTML
,JS
,Python
,Gramex
, littleTornado
). - create an app that trains, tests datasets and review the output.
- we won't be reviewing ML algorithms or scikit-learn.
This is how the application would look at the end of it:
-
Make sure you install the necessary software before you arrive at the workshop.
-
Clone this repository, stick with
master
branch. -
Use Visual Studio Code, add the cloned directory as a workspace.
-
Optionally, you can add our VSCode extension Gramex Snippets. Include the below lines in
settings.json
in VSCode for autosuggestions to work.
{
"editor.tabCompletion": "on",
"editor.quickSuggestions": {
"other": true,
"comments": false,
"strings": true
}
}
Gramex is a FOSS web and data server. One can do the below with minimal setup
- fetch, edit, delete data records
- execute arbitrary python
- auth support: database-based, active directory-based, google, social (twitter, facebook)
- capture screenshots
- configure smart email alerts and a lot more...
most of it via YAML
configuration.
Consider a dataset that you'd like to explore for exploratory data analysis, we'll use the model iris
dataset.
Before that you'd like to see the composition of the file. You can explore it using FormHandler
:
url:
data-endpoint:
pattern: /$YAMLURL/iris
handler: FormHandler
kwargs:
url: $YAMLPATH/datasets/iris.csv
Most handlers support kwargs
section to control data from server-side.
- We've limited the number of rows to
5
irrespective of how many rows end user requests. $YAMLPATH
and$YAMLURL
are Gramex predefined variables. Read more in the documentation.
formats: JSON, CSV, HTML
Multiple URL sections can be defined for different endpoints.
Arbitrary python
code can be run using FunctionHandler
.
url:
custom-python-code:
pattern: /$YAMLURL/code
handler: FunctionHandler
kwargs:
function: app.my_func
-
Access URL parameters via attributes
-
Return values
Gramex is built on top of tornado
which uses RequestHandler
for everything and we've sub-classed to different utilities for ease of use.
FileHandler
CaptureHandler
Scheduler
- read more at https://gramener.com/gramex/guide/
Head to snippets directory to begin the application building.
- Visit Cluster to explore all clustering algorithms in
scikit-learn
. - Visit our AI Labs
- Check Speech AI sample application built on Gramex https://ai.gramener.com/speechai/
- Gramex documentation - https://gramener.com/gramex/guide/
Files for building the application:
gramex.yaml
- route configuration for endpointsindex.html
- page that serves the application contenttemplate-navbar.html
- navbar contentstyle.css
-CSS
rulesreport.html
- classification output renderer
Files for the workshop:
structure.md
- workshop introductionsnippets
- code snippets to build applicationfinal.html
- compare your final application against this