Giter VIP home page Giter VIP logo

wave-apps's Introduction

Sample Wave Apps

H2O Wave allows you to build AI apps, faster. This directory houses sample applications that you can download and run locally, modify, and integrate into your own AI apps.

Installation

Follow the instructions here to download and run the latest Wave Server, a requirement for all sample apps. Then, choose an app from below for setup instructions.

Available Apps

Details: This app allows you to filter hotel reviews and compare the most common phrases from the subset to the overall most common phrases.

Details: This a game where the machine "thinks" of a number and the human has to guess, getting told higher or lower. This application has a leader board where different users can compete to see who can guess numbers in the fewest number of turns, on average. This application teaches the developer about different app states and could be fun for new users.

Details: This application allows a business user to review model predictions on whether or not someone will pay off their credit card - a model used to approve or deny credit card applications. Specifically, this app provides a list of predictions the model is not confident about (predictions in the 0.4 to 0.6 range) and allows the end user to mark someone as approved or not.

Details: This application builds a churn prediction model with H2O-3 and provides the likelihood to churn and actionable recommendations to prevent churn via nicely-presented top shapley values.

Details: This application allows a marketing anlayst to understand how their recommendation engine works. It allows them to add items to their cart and as they do a list of recommended products is updated.

Details: This application provides easy-to-use interface for exploring historical sales values and looking at future forecasts across store segments

Details: This application pulls tweets and uses the open source VaderSentiment to understand positive and negative tweets

Details: This is an example on how to add JWT-based authentication to a h2o wave app.

Details: These are a collection of self-contained applications that showcase the development of an Employee Churn application. Each application introduces additional components and progressively enhances the application with appropriate design patterns:

  • Debugging
  • Updating the content of cards without recreating them
  • Switching between multiple layouts using menu tabs

FAQs

While trying to run any of the apps particularly on Windows terminal, below are given some common errors and their fixes:

1. make (e=2): The system cannot find the file specified This is due to the os confusing between 'bin' and 'Scripts'. If you face this issue, open the Makefile present in the app folder using some Text Editor, and replace the word 'bin' with 'Scripts' in the virtual environment path of Setup and Run sections.

2. make command not found: This error comes when make is not installed on your OS. You can install make easily in Windows. More info on installing make is available on the Internet. You can also refer to their official website here: https://gnuwin32.sourceforge.net/packages/make.htm

3. Python not found: This error is probably if Windows is not able to recognise the path of Python, or if Python is not installed. In such case, install the latest version of Python from their official website https://www.python.org/downloads/ and add its path in the windows environment variables. Then restart windows. This will solve the issue.

wave-apps's People

Contributors

aranvir avatar ashishlamsal avatar ayushtiwari110 avatar boadzie avatar chathurindaranasinghe avatar denzuko avatar dulajra avatar g-eoj avatar geomodular avatar jasminepparekh avatar lo5 avatar luizlf avatar mathanraj-sharma avatar melonienimasha avatar mtanco avatar mturoci avatar nayananga avatar palani-sn avatar parulnith avatar rasika avatar sairaamv avatar srini-x avatar sudalairajkumar avatar tkmaker avatar us8945 avatar vijithaekanayake avatar vopani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wave-apps's Issues

Community apps

Have an idea for a cool small Wave app? Do not hesitate to open a PR. Note that the app should be of a reasonable complexity (beyond hello world) or showing an interesting use case.

Make example apps ready for python 3.10

Application dependencies for sample apps are outdated, most of the applications fail when deploying on appstore runtime newer than python 3.8.
Here's the list of problematic dependencies (might have false positives, created with https://github.com/h2oai/h2o-ai-integration-testing/pull/463):

./graphql-httpx-script/requirements.txt
  black==22.8.0 (✓ py3 any)
  h2o-wave==0.23.1 (✓ py3 any)
./explaining-ratings/requirements.txt
  pandas==1.1.0 (✓ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  h2o-wave<1.0 (✗ ambiguos package version)
  matplotlib (✗ ambiguos package version)
  wordcloud (✗ ambiguos package version)
./insurance-churn-risk/requirements.txt
  pandas==1.1.0 (✓ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  pygments==2.7.1 (✗ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  h2o-wave<1.0 (✗ ambiguos package version)
  h2o-wave-ml>=0.6.0 (✗ ambiguos package version)
  https://h2o-release.s3.amazonaws.com/h2o/rel-zizler/7/Python/h2o-3.34.0.7-py2.py3-none-any.whl (✗ ambiguos package version)
  black==20.8b1 (✗ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  flake8-black==0.2.1 (✓ py3 any)
  flake8-import-order==0.18.1 (✓ py3 any)
  flake8-quotes==3.2.0 (✗ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  flake8==3.8.4 (✓ py3 any)
./vscode-editor/requirements.txt
  black==22.8.0 (✓ py3 any)
  h2o-wave==0.23.1 (✓ py3 any)
./audio-recording/requirements.txt
  black==22.8.0 (✓ py3 any)
  h2o-wave==0.23.1 (✓ py3 any)
./music-and-mental-health/requirements.txt
  h2o-wave==0.24.2 (✓ py3 any)
  pandas==1.5.2 (✓ 3.8, ✓ 3.9, ✓ 3.10, ✗ 3.12)
  plotly==5.11.0 (✓ py3 any)
  siuba==0.4.2 (✓ py3 any)
./docker-development/requirements.txt
  h2o-wave (✗ ambiguos package version)
./shopping-cart-recommendations/requirements.txt
  h2o-wave<1.0 (✗ ambiguos package version)
  pandas==1.1.4 (✓ 3.8, ✓ 3.9, ✗ 3.10, ✗ 3.12)
./sales-forecasting/requirements.txt
  boto3==1.16.23 (✓ py3 any)
  botocore==1.19.23 (✓ py3 any)
  certifi==2020.11.8 (✓ py3 any)
  click==7.1.2 (✓ py3 any)
  h11==0.11.0 (✓ py3 any)
  h2o-wave<1.0 (✗ ambiguos package version)
  httpcore==0.12.2 (✓ py3 any)
  httpx==0.16.1 (✓ py3 any)
  idna==2.10 (✓ py3 any)
  jmespath==0.10.0 (✓ py3 any)
  numpy==1.19.4 (✓ 3.8, ✓ 3.9, ✗ 3.10, ✗ 3.12)
  pandas==1.1.4 (✓ 3.8, ✓ 3.9, ✗ 3.10, ✗ 3.12)
  python-dateutil==2.8.1 (✓ py3 any)
  pytz==2020.4 (✓ py3 any)
  rfc3986==1.4.0 (✓ py3 any)
  s3transfer==0.3.3 (✓ py3 any)
  six==1.15.0 (✓ py3 any)
  sniffio==1.2.0 (✓ py3 any)
  starlette==0.13.8 (✓ py3 any)
  typing-extensions==3.7.4.3 (✓ py3 any)
  urllib3==1.26.2 (✓ py3 any)
  uvicorn==0.12.2 (✓ py3 any)
./template-mlops-single-prediction/requirements.txt
  h2o_wave==0.20.0 (✓ py3 any)
  toml==0.10.2 (✓ py3 any)
  loguru==0.6.0 (✓ py3 any)
  httpx==0.16.1 (✓ py3 any)
./credit-risk/requirements.txt
  numpy==1.19.1 (✓ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  pandas==1.1.0 (✓ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  plotly==4.10.0 (✓ py3 any)
  pygments==2.7.1 (✗ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  h2o-wave<1.0 (✗ ambiguos package version)
  h2o-wave-ml>=0.7.0 (✗ ambiguos package version)
  requests (✗ ambiguos package version)
  tabulate (✗ ambiguos package version)
  colorama>=0.3.8 (✗ ambiguos package version)
  future (✗ ambiguos package version)
  https://h2o-release.s3.amazonaws.com/h2o/rel-zizler/7/Python/h2o-3.34.0.7-py2.py3-none-any.whl (✗ ambiguos package version)
./twitter-sentiment/requirements.txt
  ./h2o_wave-nightly-py3-none-any.whl (✗ ambiguos package version)
  tweepy==3.9.0 (✓ py3 any)
  vaderSentiment (✗ ambiguos package version)
./template-explore-binary-classification/requirements.txt
  h2o_wave==0.20.0 (✓ py3 any)
  toml==0.10.2 (✓ py3 any)
  loguru==0.6.0 (✓ py3 any)
  pandas==1.4.1 (✓ 3.8, ✓ 3.9, ✓ 3.10, ✗ 3.12)
  matplotlib==3.5.1 (✓ 3.8, ✓ 3.9, ✓ 3.10, ✗ 3.12)
./jwt-auth/requirements.txt
  h2o-wave==0.25.2 (✓ py3 any)
  mongoengine (✗ ambiguos package version)
  python-jose[cryptography] (✗ ambiguos package version)
  passlib[bcrypt] (✗ ambiguos package version)
./emp-churn-step-by-step/requirements.txt
  h2o-wave==0.24.0 (✓ py3 any)
./guess-the-number/requirements.txt
  certifi==2020.12.5 (✓ py3 any)
  click==7.1.2 (✓ py3 any)
  h11==0.11.0 (✓ py3 any)
  h2o-wave<1.0 (✗ ambiguos package version)
  httpcore==0.12.2 (✓ py3 any)
  httpx==0.16.1 (✓ py3 any)
  idna==2.10 (✓ py3 any)
  rfc3986==1.4.0 (✓ py3 any)
  sniffio==1.2.0 (✓ py3 any)
  starlette==0.13.8 (✓ py3 any)
  typing-extensions==3.7.4.3 (✓ py3 any)
  uvicorn==0.12.2 (✓ py3 any)
./churn-risk/requirements.txt
  pandas==1.1.0 (✓ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  pygments==2.7.1 (✗ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  h2o-wave<1.0 (✗ ambiguos package version)
  h2o-wave-ml>=0.7.0 (✗ ambiguos package version)
  https://h2o-release.s3.amazonaws.com/h2o/rel-zizler/7/Python/h2o-3.34.0.7-py2.py3-none-any.whl (✗ ambiguos package version)
  black==20.8b1 (✗ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  flake8-black==0.2.1 (✓ py3 any)
  flake8-import-order==0.18.1 (✓ py3 any)
  flake8-quotes==3.2.0 (✗ 3.8, ✗ 3.9, ✗ 3.10, ✗ 3.12)
  flake8==3.8.4 (✓ py3 any)

Update Twitter App

The Twitter Sentiment app works - you search for a key word and very quickly it returns recent tweets and sentiment, this is the full functionality we need for this app. It could use some front and backend polishing:

  • It would be nice if wave run src.app was how you ran this (and all) apps
  • Missing a read me for how to set up
  • A top header bar would be good
  • Change starting word from Trump to AI or H2O or something like that
  • General code review

Currently the twitter credentials are hardcoded for us for testing. Let's add a form element that asks for the user's Twitter API Key, too. The tool tip for this can link to https://developer.twitter.com/en/docs/authentication/oauth-1-0a/obtaining-user-access-tokens

Clean Credit Usage Data

The Credit Usage Kaggle data uses encodings which can be hard to read, using the Kaggle summary lookup table we can update the data as follows:


# Original Dataset: https://www.kaggle.com/uciml/default-of-credit-card-clients-dataset

import pandas as pd
import numpy as np
pd.set_option('display.max_columns', None)


df = pd.read_csv('CreditCard-train.csv')

# Gender (1=male, 2=female)
df['SEX'] = np.select([df['SEX'] == 1, df['SEX'] == 2, ~df['SEX'].isin([1, 2])],
                      ['Male', 'Female', None])

# (1=graduate school, 2=university, 3=high school, 4=others, 5=unknown, 6=unknown)
df['EDUCATION'] = np.select([df['EDUCATION'] == 1, df['EDUCATION'] == 2, df['EDUCATION'] == 3, df['EDUCATION'] == 4,
                             ~df['EDUCATION'].isin([1, 2, 3, 4])],
                            ['Graduate School', 'University', 'High School', 'Other', None])

# MARRIAGE: Marital status (1=married, 2=single, 3=others)
df['MARRIAGE'] = np.select([df['MARRIAGE'] == 1, df['MARRIAGE'] == 2, df['MARRIAGE'] == 3,
                            ~df['MARRIAGE'].isin([1, 2, 3])],
                           ['Married', 'Single', 'Other', None])

# TODO: Rename for consistency
df = df.rename(columns={'PAY_0': 'PAY_1'})

# TODO: change PAY_X to categoricals

# TODO: change target column for consistency
df = df.rename(columns={'default.payment.next.month': 'DEFAULT_PAYMENT'})

# Change target column to boolean for h2o-3 data typing
df['DEFAULT_PAYMENT'] = np.where(df['DEFAULT_PAYMENT'] == 1, True, False)

print(df.head())

How to update data

Hello!

Thanks for you work, H2O Wave is really good.
I have this code for testing

from h2o_wave import main, app, data, Q, ui
import time
from random import randrange

values_1 = []
values_2 = []

# make some data
for i in range(0,25):
	values_1.append(("CH1", i, randrange(100)))
	values_2.append(("CH2", i, randrange(100)))
	
@app('/demo')
async def serve(q: Q):

    q.page['meta'] = ui.meta_card(box='', layouts=[
        ui.layout(
            breakpoint='xl',
            width='1200px',
            zones=[
                ui.zone('header'),
                ui.zone('control'),
                ui.zone('top', direction=ui.ZoneDirection.ROW, size='385px', zones=[
                    ui.zone('top_left', direction=ui.ZoneDirection.ROW, size='66%'),
                    ui.zone('top_right'),
                ]),
                ui.zone('middle', direction=ui.ZoneDirection.ROW, size='400px'),
                ui.zone('bottom', direction=ui.ZoneDirection.ROW, size='200px'),
                ui.zone('footer'),
            ]
        )
    ])
    
    q.page['stats'] = ui.form_card(
        box='middle',
        title="Channel Power",
        items=[
            ui.stats(items=[
                ui.stat(label=("Man"), value=("Manuel")),
                ui.stat(label=("1234"), value=("1234")),
            ], justify=ui.StatsJustify.BETWEEN, inset=True),
            ui.visualization(
                plot=ui.plot([
                    ui.mark(type='line', x_scale='linear', x='=date', y='=visitors', color='=site',
                            color_range='$orange $amber', curve=ui.MarkCurve.SMOOTH),
                    ui.mark(type='line', x_scale='linear', x='=date', y='=visitors', color='=site',
                            color_range='$orange $amber', curve=ui.MarkCurve.SMOOTH),
                ]),
                data=data(
                    fields=['site', 'date', 'visitors'],
                    rows= values_1+ values_2,
                    pack=True
                ),
                height='240px',
            )
        ],
    )
    await q.page.save()

Now, i would update the stats.data, but it doesnt work and i cant find an example.

from h2o_wave import site, data
import time
from random import randrange

page = site['/demo']
quote = page['stats']

values_1 = []
values_2 = []

i = 0

while True:

	if len(values_1) == 26:
		values_1.pop(0)
		values_2.pop(0)
		
	values_1.append(("CH1", i, randrange(100)))
	values_2.append(("CH2", i, randrange(100)))
		
	time.sleep(0.25)
	quote.data = values_1 + values_2
	page.save()
	i = i + 1

Thanks for your help.

Look into Telco Churn Warnings

I get the following warnings in the console when running the Churn application - it would be good to do a code check with these in mind and see if anything needs to be changed.

./src/plots.py:43: SettingWithCopyWarning:


A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy

./src/plots.py:43: SettingWithCopyWarning:


A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy

./src/plots.py:43: SettingWithCopyWarning:


A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy

./src/plots.py:43: SettingWithCopyWarning:


A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy

./src/plots.py:26: SettingWithCopyWarning:


A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy

/Users/mtanco/h2o_wave/wave-apps/churn-risk/venv/lib/python3.8/site-packages/h2o/explanation/_explain.py:975: RuntimeWarning:

More than 20 figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).

Update Makefiles

Some of the Makefiles are dated and include items from when Wave was Q. It's worth cleaning them up so that they only have commands that are helpful and usable today to improve the developer experience.

Make setup instructions more inclusive

Current setup instructions require make to be installed. However, this can be a showstopper for windows users which lacks make installation by default.

We could either:

  • Rewrite the instructions to plain python commands.
  • Find OS agnostic alternative to make.

cc @mtanco @geomodular for discussion

Add App Usage to ReadMEs

and screenshots as appropriate

I like the Credit Risk Read Me format, would be nice if they were all similar

Support for Path-Based Routing

Some Hybrid cloud customers will choose to only install apps which use path-based routing (for security and cost-savings reasons) - this feature will be availabe in App Store 0.14.0 and HAIC 22.01.3. To prepare, we recommend updating your app so that it can be used at these customer accounts.

Requirements:

  • Upgrade to H2O Wave 0.20.0
  • Add the following line to your app.toml [Runtime] section: RoutingMode = "BASE_URL"
  • Test that your app works as expected in cloud-dev which has this feature available

Verify and release OSS apps 1.0.0

With the release verification Let's update all the applications to support the Path-based routing reported in this issue.

Churn Risk Menu Change

image

If you are on an the App Code page #code and change the mode from light to dark you are taken to the home page, but the navigation does not change. This means that if you try to go back to #code it doesn't work.

Update Tags in OSS Apps

While working on the managed cloud we noticed this warning while uploading the OSS Apps

11:37AM WRN Category field in bundle configuration has been deprecated and will be removed in future releases
11:37AM WRN Keywords field in bundle configuration has been deprecated and will be removed in future releases

Apps are being uploaded under "Other" Tag
image

Can't run sales forecasting example

I followed the instructions but it is throwing an error:

httpcore.ConnectError: [Errno 111] Connect call failed ('127.0.0.1', 55555)

Examples like churn-risk and shopping-cart-recommendations worked fine.

I'm using a linux server.

Is there anything else to configure?

Use Case Updates for Churn Risk

  • Update the churn_predictor class to be dataset agnostic. It should take any required, data-specific features as parameters so that it is easy for end users to use the class for their own datasets.
  • Use the Insurance Churn dataset instead of Telco - H2O has more than one demo application using the Telco Churn dataset and it would be nice to show a different industry. https://www.kaggle.com/ycanario/home-insurance
  • Confirm that MLI is working as expected on a new dataset

Improve audio-recording app

Audio recording app is currently pretty barebone - just a single button.

It could use some UI love:

  • Header.
  • Imagery + button.
  • Change of imagery when recording.
  • Footer.

Other ideas for improvement are welcome as well.

log4j vulnerability

I used log4j detecor to check the vulnerable apps in my system and found out that wave-apps is using old version of log4j which is vulnerable.

Output- wave-apps/churn-risk/venv/lib/python3.7/site-packages/h2o/backend/bin/h2o.jar contains Log4J-1.x <= 1.2.17 _OLD_

Credit Risk Read Me updates

  • The read me says that python 3.8 is required, but the H2O AI App Store uses 3.7 - is it incompatible or just untested?
  • Add how to run tests in the read me
  • Add details on the 3 requirements files in the readme

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.