Skip to content
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

Models Hub v2.9.0 #13361

Merged
merged 11 commits into from
Jan 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 61 additions & 6 deletions .github/workflows/create_search_index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
branches:
- master

concurrency:
# Make sure only workflow run at a time for create_search_index.yml
group: ${{ github.workflow }}

jobs:
jekyll:
runs-on: ubuntu-latest
Expand All @@ -18,22 +22,57 @@ jobs:
ruby-version: 2.7
working-directory: docs
bundler-cache: true
- name: Index changed posts
- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: create_search_index.yml
workflow_conclusion: success
name: jekyll-build
path: docs
if_no_artifact_found: ignore
- name: Extract artifacts
working-directory: docs
run: >
(7z x -o_site/ jekyll-content.zip
&& rm jekyll-content.zip
&& mv _site/.jekyll-metadata ./
&& mv _site/backup-models.json ./
&& mv _site/backup-benchmarking.json ./
&& mv _site/backup-references.json ./)
|| true
- name: Incremental build
id: incremental-build
env:
ELASTICSEARCH_URL: ${{ secrets.ELASTICSEARCH_URL }}
ELASTICSEARCH_ACCESS_TOKEN: ${{ secrets.ELASTICSEARCH_ACCESS_TOKEN }}
ELASTICSEARCH_INDEX_NAME: ${{ secrets.ELASTICSEARCH_INDEX_NAME }}
SEARCH_ORIGIN: ${{ secrets.SEARCH_ORIGIN }}
working-directory: docs
run: |
bundle exec jekyll build --incremental
continue-on-error: ${{ steps.incremental-build.outputs.require_full_build == 'true' }}
- name: Full build
id: full-build
if: ${{ steps.incremental-build.outputs.require_full_build == 'true' }}
env:
ELASTICSEARCH_URL: ${{ secrets.ELASTICSEARCH_URL }}
ELASTICSEARCH_ACCESS_TOKEN: ${{ secrets.ELASTICSEARCH_ACCESS_TOKEN }}
ELASTICSEARCH_INDEX_NAME: ${{ secrets.ELASTICSEARCH_INDEX_NAME }}
SEARCH_ORIGIN: ${{ secrets.SEARCH_ORIGIN }}
working-directory: docs
run: |
git diff --name-only ${{github.event.before}}..${{github.event.after}} > changes.txt
git diff --name-only ${{github.event.after}}..${{github.event.before}} >> changes.txt
bundle exec jekyll build
- uses: actions/setup-node@v2
rm -f .jekyll-metadata
FULL_BUILD=1 bundle exec jekyll build --incremental
- uses: actions/setup-node@v3
with:
node-version: 14
node-version: 16
cache: yarn
cache-dependency-path: docs/_frontend/yarn.lock
- name: Build frontend
working-directory: docs/_frontend
env:
SEARCH_ORIGIN: ${{ secrets.SEARCH_ORIGIN }}
run: |
yarn
yarn run build
Expand All @@ -43,3 +82,19 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_site
- name: Zip contents for artifacts
uses: vimtor/action-zip@v1
with:
files: >
./docs/_site/
./docs/.jekyll-metadata
./docs/backup-models.json
./docs/backup-benchmarking.json
./docs/backup-references.json
dest: jekyll-content.zip
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: jekyll-build
path: |
./jekyll-content.zip
4 changes: 4 additions & 0 deletions docs/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ gem 'wdm', '~> 0.1.0'
gem "webrick"

gem "jekyll", "~> 3.9"

group "jekyll-plugins" do
gem "jekyll-incremental", "0.1.0", path: "_plugins/jekyll-incremental"
end
7 changes: 7 additions & 0 deletions docs/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
PATH
remote: _plugins/jekyll-incremental
specs:
jekyll-incremental (0.1.0)
jekyll (~> 3.9)

GEM
remote: https://rubygems.org/
specs:
Expand Down Expand Up @@ -297,6 +303,7 @@ DEPENDENCIES
elasticsearch (~> 7.10)
github-pages (= 227)
jekyll (~> 3.9)
jekyll-incremental (= 0.1.0)!
nokogiri (>= 1.13.9)
wdm (~> 0.1.0)
webrick
Expand Down
4 changes: 3 additions & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ exclude:
- /screenshots
- /test
- /vendor
- backup-*.json
- /_frontend

defaults:
Expand All @@ -225,4 +226,5 @@ plugins:
- jekyll-feed
- jekyll-paginate
- jekyll-sitemap
- jemoji
- jemoji
- jekyll-incremental
41 changes: 1 addition & 40 deletions docs/_frontend/src/models/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,7 @@ import React, { useState, useEffect } from 'react';
import Form from '../Form';
import ModelItem from '../ModelItem';
import ModelItemList from '../ModelItemList';

const SEARCH_ORIGIN = 'https://search.modelshub.johnsnowlabs.com';

const toSearchString = (params) => {
const searchParams = Object.keys(params).reduce((acc, k) => {
if (params[k]) {
switch (k) {
case '_type':
break;

case 'supported':
acc.append(k, Number(params[k]));
break;

case 'tags':
case 'predicted_entities':
params[k].forEach((v) => {
acc.append(k, v);
});
break;
case 'sort':
if (params[k] !== 'date') {
acc.append(k, params[k]);
}
break;
case 'recommended':
break;
default:
acc.append(k, params[k]);
break;
}
} else {
if (k === 'recommended') acc.append(k, Number(params[k]));
}
return acc;
}, new URLSearchParams());

const search = searchParams.toString();
return search ? '?' + search : '';
};
import { SEARCH_ORIGIN, toSearchString } from '../common';

const fromSearchString = () => {
const params = {};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@

.selectedItem {
display: inline-flex;
background: #e2e6ee;
border-radius: 2px;
align-items: center;
margin: 4px;
margin-top: 0;
margin-left: 0;
max-width: 100%;
}

.selectedItem__value {
padding: 2px 4px;
line-height: 14px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
min-width: 0;
}

.selectedItem__x {
display: flex;
width: 20px;
height: 20px;
justify-content: center;
align-items: center;
cursor: default;

&:hover {
background: #9ea8bd;
color: #fff;
}
}

.combobox {
display: flex;
background: #ffffff;
border: 1px solid #e8e9ea;
box-sizing: border-box;
border-radius: 2px;
}

.combobox__input {
border: none;
background: transparent;
min-width: 0;
font-family: Roboto, sans-serif;
font-weight: 500;
font-size: 14px;
line-height: 24px;
padding: 6px 16px;
padding-right: 0;
width: 100%;
}

.combobox__toggle {
background-image: url("data:image/svg+xml,%3Csvg width='14' height='8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m5.757 5.76.653-.757-.653.757Zm2.609.003-.651-.758.65.758Zm-1.956-.76L1.653.901.347 2.415l4.757 4.103L6.41 5.003ZM12.5.9 7.715 5.005l1.302 1.517 4.784-4.105L12.5.899ZM5.104 6.518a3 3 0 0 0 3.913.004L7.715 5.005a1 1 0 0 1-1.305-.002L5.104 6.518Z' fill='%23FF8A00'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: 50% 50%;
width: 36px;
height: 36px;
flex-shrink: 0;
}

.menuWrapper {
position: relative;
z-index: 1000;
}

.menu {
background: #ffffff;
border: 1px solid #e7edf0;
box-sizing: border-box;
box-shadow: 0px 5px 25px rgba(30, 119, 183, 0.25);
padding: 0;
margin: 0;
position: absolute;
list-style: none;
min-width: 100%;
max-height: 240px;
overflow: scroll;
}

.menu__item {
font-family: Roboto, sans-serif;
font-style: normal;
font-weight: 500;
font-size: 13px;
line-height: 18px;
padding: 6px 12px;
box-sizing: border-box;
}

.menu__item.isEmpty {
text-align: center;
color: #9ea8bd;
font-weight: normal;
}
Loading