This commit is contained in:
Abubakar Abid 2021-12-24 11:34:25 -06:00
commit 2f90610247
26 changed files with 23683 additions and 71 deletions

View File

@ -39,7 +39,7 @@ module.exports = {
},
style: {
postcss: {
plugins: [require("tailwindcss"), require("autoprefixer")]
plugins: [require("postcss-prefixwrap")(".gradio_app"), require("tailwindcss"), require("autoprefixer")]
}
}
};

23487
frontend/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -17,6 +17,7 @@
"html2canvas-objectfit-fix": "^1.2.0",
"jspreadsheet-ce": "^4.7.3",
"mime-types": "^2.1.33",
"postcss-prefixwrap": "^1.26.0",
"prettier-eslint": "^13.0.0",
"prettier-eslint-cli": "^5.0.1",
"react": "^17.0.2",
@ -24,7 +25,6 @@
"react-cropper": "^2.1.8",
"react-dom": "^17.0.2",
"react-json-tree": "^0.15.0",
"react-plotly.js": "^2.5.1",
"react-scripts": "4.0.3",
"react-webcam": "^5.2.3",
"recorder-js": "^1.0.7",
@ -36,7 +36,7 @@
"scripts": {
"start": "cross-env REACT_APP_BACKEND_URL='http://localhost:7860/' craco start",
"format": "prettier-eslint --write '**/*.js*'",
"build": "cross-env REACT_APP_BACKEND_URL='' GENERATE_SOURCEMAP=false craco build",
"build": "cross-env REACT_APP_BACKEND_URL='' REACT_APP_VERSION=$(cat ../gradio/version.txt) GENERATE_SOURCEMAP=false craco build",
"eject": "react-scripts eject"
},
"eslintConfig": {

View File

@ -24,10 +24,10 @@
}
gtag('js', new Date());
gtag('config', 'UA-156449732-1');
window.gradio_mode = "app";
try {
window.gradio_config = {{ config|tojson }};
} catch (e) {
window.gradio_config = {"mode": "dev"};
}
</script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script>

View File

@ -5,8 +5,7 @@ import { saveAs } from "./utils";
import ReactDOM from "react-dom";
import classNames from "classnames";
import logo_loading from "./static/img/logo_loading.jpg";
import logo_error from "./static/img/logo_error.png";
import logo_error from "./static/img/logo_error.svg";
import logo from "./static/img/logo.svg";
import api_logo from "./static/img/api-logo.svg";
import("./themes/defaults.scss");
@ -305,23 +304,23 @@ export class GradioInterface extends React.Component {
expected_duration *= this.state.initial_queue_index + 2;
}
status = (
<div className="loading">
<div className="load_status">
<MemoizedGradioTimer expected_duration={expected_duration} />
{this.state.queue_index !== null && this.state.queue_index >= 0
? "queued @ " + this.state.queue_index
: false}
<img alt="loading" src={logo_loading} />
<img class="loading" alt="loading" src={logo} />
</div>
);
} else if (this.state.error) {
status = (
<div className="loading">
<img className="loading_failed" alt="error" src={logo_error} />
<div className="load_status">
<img className="error" alt="error" src={logo_error} />
</div>
);
} else if (this.state.complete && this.state.last_duration !== null) {
status = (
<div className="loading">
<div className="load_status">
{this.state.last_duration.toFixed(2) + "s"}
</div>
);
@ -379,7 +378,7 @@ export class GradioInterface extends React.Component {
>
<div
className={classNames("component_set", "relative", {
"opacity-50": this.pending_response && !this.props.live
"opacity-50": (this.pending_response && !this.props.live) || this.state.error
})}
>
{status}

View File

@ -1,3 +1,4 @@
import "./public-path";
import React from "react";
import ReactDOM from "react-dom";
import { GradioPage } from "./gradio";
@ -59,6 +60,7 @@ let fn = async (api_endpoint, queue, data, action, queue_callback) => {
window.launchGradio = (config, element_query, space) => {
let target = document.querySelector(element_query);
target.classList.add("gradio_app");
if (config.auth_required) {
ReactDOM.render(
<Login {...config} />, target
@ -110,7 +112,7 @@ async function get_config() {
return window.gradio_config;
}
}
if (window.gradio_config) {
if (window.gradio_mode == "app") {
get_config().then(config => {
launchGradio(config, "#root");
});

View File

@ -0,0 +1 @@
__webpack_public_path__ = window.gradio_mode == "app" ? "/" : "https://gradio.s3-us-west-2.amazonaws.com/" + process.env.REACT_APP_VERSION + "/";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -0,0 +1,134 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="40.810085mm"
height="10.393202mm"
viewBox="0 0 40.810087 10.393202"
version="1.1"
id="svg5"
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
sodipodi:docname="logo_error.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="2.7313686"
inkscape:cx="97.020959"
inkscape:cy="33.133573"
inkscape:window-width="1278"
inkscape:window-height="991"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="g880" />
<defs
id="defs2" />
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-90.438365,-136.96404)">
<path
style="fill:#000000;stroke-width:1.02388"
id="path21"
d="" />
<path
style="fill:#000000;stroke-width:0.271737"
id="path3317"
d="" />
<g
id="g880"
transform="matrix(0.56975915,0,0,0.56975915,63.360109,62.438369)">
<g
id="g842"
transform="matrix(0.79495203,0,0,0.79495203,13.79033,28.860894)">
<rect
style="fill:#f08a8d;fill-opacity:1;stroke-width:0.0478859"
id="rect5331-6-3-1-7"
width="10.522298"
height="2.9480448"
x="-146.48871"
y="70.555779"
transform="matrix(-0.87679283,-0.48086831,0,1,0,0)" />
<rect
style="fill:#f08a8d;fill-opacity:1;stroke-width:0.0478859"
id="rect5331-6-3-1"
width="10.522298"
height="2.9480448"
x="-146.48871"
y="65.439095"
transform="matrix(-0.87679283,-0.48086831,0,1,0,0)" />
<rect
style="fill:#ec7c80;fill-opacity:1;stroke-width:0.0478841"
id="rect5331-6-4"
width="10.56119"
height="2.9670203"
x="135.93057"
y="206.32899"
transform="matrix(0.87677457,-0.48090161,0,1,0,0)" />
<rect
style="fill:#f08a8d;fill-opacity:1;stroke-width:0.0478859"
id="rect5331-6-3-1-3"
width="10.561918"
height="2.9670298"
x="-135.92775"
y="75.596405"
transform="matrix(-0.87679283,-0.48086831,0,1,0,0)" />
<rect
style="fill:#ec7c80;fill-opacity:1;stroke-width:0.0479552"
id="rect5331-6-3"
width="10.592357"
height="2.9670446"
x="125.25629"
y="195.93875"
transform="matrix(0.87755288,-0.47947986,0,1,0,0)" />
<rect
style="fill:#ec7c80;fill-opacity:1;stroke-width:0.0478841"
id="rect5331-6-4-9"
width="10.56119"
height="2.9670203"
x="135.93057"
y="211.44563"
transform="matrix(0.87677457,-0.48090161,0,1,0,0)" />
<rect
style="fill:#f08a8d;fill-opacity:1;stroke-width:0.0478859"
id="rect5331-6-3-1-3-1"
width="10.561918"
height="2.9670298"
x="-135.92775"
y="80.713081"
transform="matrix(-0.87679283,-0.48086831,0,1,0,0)" />
<rect
style="fill:#ec7c80;fill-opacity:1;stroke-width:0.0479552"
id="rect5331-6-3-2"
width="10.592357"
height="2.9670446"
x="125.25629"
y="201.05539"
transform="matrix(0.87755288,-0.47947986,0,1,0,0)" />
</g>
<text
xml:space="preserve"
style="font-size:12.9405px;line-height:1.25;font-family:Arial;-inkscape-font-specification:Arial;fill:#ec7c80;fill-opacity:1;stroke-width:0.323512"
x="50.629585"
y="144.87993"
id="text6662"><tspan
sodipodi:role="line"
id="tspan6660"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:Arial;-inkscape-font-specification:'Arial Bold';fill:#ec7c80;fill-opacity:1;stroke-width:0.323512"
x="50.629585"
y="144.87993">ERROR</tspan></text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

View File

@ -78,12 +78,25 @@
.gradio_bg[theme="default"] .gradio_interface {
.loading {
.load_status {
@apply dark:text-gray-50 absolute right-2 flex items-center gap-2;
}
.loading img {
.load_status img {
@apply h-5 ml-2 inline-block;
}
.load_status .loading {
@keyframes ld-breath{
0%{
animation-timing-function:cubic-bezier(0.9647,0.2413,-0.0705,0.7911);
transform:scale(0.9)
}
51%{animation-timing-function:cubic-bezier(0.9226,0.2631,-0.0308,0.7628);
transform:scale(1.2)
}
100%{transform:scale(0.9)}
}
animation:ld-breath 0.75s infinite linear;
}
.panels {
@apply flex flex-wrap justify-center gap-4;
}

View File

@ -7,10 +7,10 @@ html {
}
.gradio_bg[theme="grass"] .gradio_interface {
.loading {
.load_status {
@apply absolute dark:text-gray-50 right-2 flex items-center gap-2 text-xs;
}
.loading img {
.load_status img {
@apply h-5;
}
.panels {

View File

@ -3,10 +3,10 @@
}
.gradio_bg[theme="huggingface"] .gradio_interface {
.loading {
.load_status {
@apply text-gray-700 dark:text-gray-50 absolute right-2 flex items-center gap-2 text-sm;
}
.loading img {
.load_status img {
@apply h-5;
}
.panels {

View File

@ -4,10 +4,10 @@
.gradio_bg[theme="peach"] .gradio_interface {
.loading {
.load_status {
@apply dark:text-gray-50 absolute right-2 flex items-center gap-2;
}
.loading img {
.load_status img {
@apply h-5 ml-2 inline-block;
}
.panels {

View File

@ -1,14 +1,11 @@
Metadata-Version: 2.1
Metadata-Version: 1.0
Name: gradio
Version: 2.6.1
Version: 2.6.2
Summary: Python library for easily interacting with trained machine learning models
Home-page: https://github.com/gradio-app/gradio-UI
Author: Abubakar Abid, Ali Abid, Ali Abdalla, Dawood Khan, Ahsen Khaliq
Author-email: team@gradio.app
License: Apache License 2.0
Description: UNKNOWN
Keywords: machine learning,visualization,reproducibility
Platform: UNKNOWN
License-File: LICENSE
UNKNOWN

View File

@ -1,15 +1,15 @@
numpy
pydub
matplotlib
pandas
pillow
ffmpy
markdown2
pycryptodome
requests
paramiko
analytics-python
Flask>=1.1.1
Flask-Cors>=3.0.8
flask-cachebuster
Flask-Login
Flask>=1.1.1
analytics-python
ffmpy
flask-cachebuster
markdown2
matplotlib
numpy
pandas
paramiko
pillow
pycryptodome
pydub
requests

View File

@ -43,7 +43,7 @@ VERSION_FILE = pkg_resources.resource_filename("gradio", "version.txt")
with open(VERSION_FILE) as version_file:
GRADIO_STATIC_ROOT = "https://gradio.s3-us-west-2.amazonaws.com/" + \
version_file.read().strip() + "/static/"
version_file.read() + "/static/"
app = Flask(__name__,
template_folder=STATIC_TEMPLATE_LIB,

View File

@ -1,19 +1,19 @@
{
"files": {
"main.css": "/static/css/main.54d5b21c.css",
"main.css": "/static/css/main.bd8d8c8b.css",
"main.js": "/static/bundle.js",
"index.html": "/index.html",
"static/media/api-logo.93f17adb.svg": "/static/media/api-logo.93f17adb.svg",
"static/media/arrow-left.794a4706.svg": "/static/media/arrow-left.794a4706.svg",
"static/media/arrow-right.5a7d4ada.svg": "/static/media/arrow-right.5a7d4ada.svg",
"static/media/clear.85cf6de8.svg": "/static/media/clear.85cf6de8.svg",
"static/media/edit.c6b7d6f7.svg": "/static/media/edit.c6b7d6f7.svg",
"static/media/logo.36a8f455.svg": "/static/media/logo.36a8f455.svg",
"static/media/logo_loading.e93acd82.jpg": "/static/media/logo_loading.e93acd82.jpg"
"static/media/api-logo.b3893a52.svg": "/static/media/api-logo.b3893a52.svg",
"static/media/arrow-left.e497f657.svg": "/static/media/arrow-left.e497f657.svg",
"static/media/arrow-right.ea6059fd.svg": "/static/media/arrow-right.ea6059fd.svg",
"static/media/clear.33f9b5f3.svg": "/static/media/clear.33f9b5f3.svg",
"static/media/edit.44bd4fe1.svg": "/static/media/edit.44bd4fe1.svg",
"static/media/logo.411acfd1.svg": "/static/media/logo.411acfd1.svg",
"static/media/logo_error.0d6fa515.svg": "/static/media/logo_error.0d6fa515.svg"
},
"entrypoints": [
"static/bundle.css",
"static/css/main.54d5b21c.css",
"static/css/main.bd8d8c8b.css",
"static/bundle.js"
]
}

View File

@ -4,8 +4,8 @@
}
gtag('js', new Date());
gtag('config', 'UA-156449732-1');
window.gradio_mode = "app";
try {
window.gradio_config = {{ config|tojson }};
} catch (e) {
window.gradio_config = {"mode": "dev"};
}</script><script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script><title>Gradio</title><link href="static/bundle.css" rel="stylesheet"><link href="static/css/main.54d5b21c.css" rel="stylesheet"></head><body style="height:100%;margin:0;padding:0"><div id="root" style="height:100%"></div><script src="static/bundle.js"></script></body></html>
}</script><script src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.1/iframeResizer.contentWindow.min.js"></script><title>Gradio</title><link href="static/bundle.css" rel="stylesheet"><link href="static/css/main.bd8d8c8b.css" rel="stylesheet"></head><body style="height:100%;margin:0;padding:0"><div id="root" style="height:100%"></div><script src="static/bundle.js"></script></body></html>

View File

@ -1 +1 @@
2.6.1
2.6.2

View File

@ -5,7 +5,7 @@ except ImportError:
setup(
name='gradio',
version='2.6.1',
version='2.6.2',
include_package_data=True,
description='Python library for easily interacting with trained machine learning models',
author='Abubakar Abid, Ali Abid, Ali Abdalla, Dawood Khan, Ahsen Khaliq',

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 KiB

After

Width:  |  Height:  |  Size: 364 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -7,19 +7,14 @@ echo "Current version is $old_version. New version?"
read new_version
sed -i "s/version='$old_version'/version='$new_version'/g" setup.py
read -p "npm build? " -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
cd frontend
npm run build
cd ..
fi
read -p "frontend updates? " -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo -n $new_version > gradio/version.txt
cd frontend
npm run build
cd ..
aws s3 cp gradio/templates/frontend s3://gradio/$new_version/ --recursive
echo $new_version > gradio/version.txt
fi
rm -r dist/*