python format fix [hotfix] (#615)

* format fix

* fix image tests

Co-authored-by: Ali Abid <aliabid94@gmail.com>
This commit is contained in:
aliabid94 2022-02-14 21:03:51 -08:00 committed by GitHub
parent df325d6a37
commit 2734bd782e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 33 additions and 67 deletions

View File

@ -793,6 +793,7 @@ class Timeseries(OutputComponent):
def restore_flagged(self, dir, data, encryption_key):
return json.loads(data)
class Chatbot(OutputComponent):
"""
Component displays a chatbot output showing both user submitted messages and responses
@ -827,7 +828,6 @@ class Chatbot(OutputComponent):
return y
class State(OutputComponent):
"""
Special hidden component that stores state across runs of the interface.

View File

@ -41,9 +41,7 @@ class GuidesLoader(BaseLoader):
return source, path, lambda: mtime == getmtime(path)
readme_template = Environment(loader=GuidesLoader(".")).get_template(
README_TEMPLATE
)
readme_template = Environment(loader=GuidesLoader(".")).get_template(README_TEMPLATE)
output_readme = readme_template.render(code=code, demos=demos)
output_readme = output_readme.replace("(/assets/", "(website/homepage/src/assets/")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 236 KiB

After

Width:  |  Height:  |  Size: 237 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -16,7 +16,7 @@ importers:
svelte: 3.46.3
svelte-check: 2.4.1_svelte@3.46.3
svelte-i18n: 3.3.13_svelte@3.46.3
vitest: 0.3.2
vitest: 0.3.5
packages/app:
specifiers:
@ -60,7 +60,7 @@ importers:
postcss: 8.4.6
postcss-nested: 5.0.6_postcss@8.4.6
svelte: 3.46.3
tailwindcss: 3.0.19_autoprefixer@9.8.8+postcss@8.4.6
tailwindcss: 3.0.22_autoprefixer@9.8.8
vite: 2.7.13
packages/components:
@ -1120,19 +1120,7 @@ packages:
optional: true
/function-bind/1.1.1:
<<<<<<< HEAD
<<<<<<< HEAD
resolution:
{
integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
}
=======
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
>>>>>>> parent of 2438b0bb (more pretty formatting)
dev: true
=======
resolution: {integrity: sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==}
>>>>>>> master
/gauge/3.0.2:
resolution: {integrity: sha512-+5J6MS/5XksCuXq++uFRsnUd7Ovu1XenbeuIuNRJxYWjgQbPuFhT14lAvsWfqfAmnwluf1OwMjz39HjfLPci0Q==}
@ -1720,10 +1708,6 @@ packages:
/path-parse/1.0.7:
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
<<<<<<< HEAD
=======
dev: true
>>>>>>> parent of 2438b0bb (more pretty formatting)
/path-type/4.0.0:
resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
@ -2065,22 +2049,8 @@ packages:
dev: false
/source-map-js/1.0.2:
<<<<<<< HEAD
<<<<<<< HEAD
resolution:
{
integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==
}
engines: { node: ">=0.10.0" }
=======
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
engines: {node: '>=0.10.0'}
>>>>>>> parent of 2438b0bb (more pretty formatting)
dev: true
=======
resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==}
engines: {node: '>=0.10.0'}
>>>>>>> master
/source-map/0.6.1:
resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==}
@ -2165,22 +2135,8 @@ packages:
dev: true
/supports-preserve-symlinks-flag/1.0.0:
<<<<<<< HEAD
<<<<<<< HEAD
resolution:
{
integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
}
engines: { node: ">= 0.4" }
=======
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'}
>>>>>>> parent of 2438b0bb (more pretty formatting)
dev: true
=======
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'}
>>>>>>> master
/svelte-check/2.4.1_svelte@3.46.3:
resolution: {integrity: sha512-xhf3ShP5rnRwBokrgTBJ/0cO9QIc1DAVu1NWNRTfCDsDBNjGmkS3HgitgUadRuoMKj1+irZR/yHJ+Uqobnkbrw==}
@ -2349,13 +2305,12 @@ packages:
dev: false
optional: true
/tailwindcss/3.0.19_autoprefixer@9.8.8+postcss@8.4.6:
resolution: {integrity: sha512-rjsdfz/qZya5xQ0OVynEMETgWq1CacmftgMYeXXh6bRM5vxsNwRSbMJsCCIjq/w67om9VP/AFMolOwiE+5VKig==}
/tailwindcss/3.0.22_autoprefixer@9.8.8:
resolution: {integrity: sha512-F8lt74RlNZirnkaSk310+vGQta7c0/hgx7/bqxruM4wS9lp8oqV93lzavajC3VT0Lp4UUtUVIt8ifKcmGzkr0A==}
engines: {node: '>=12.13.0'}
hasBin: true
peerDependencies:
autoprefixer: ^10.0.2
postcss: ^8.0.9
dependencies:
arg: 5.0.1
autoprefixer: 9.8.8
@ -2396,13 +2351,13 @@ packages:
dev: false
optional: true
<<<<<<< HEAD
/tiny-glob/0.2.9:
resolution: {integrity: sha512-g/55ssRPUjShh+xkfx9UPDXqhckHEsHr4Vd9zX55oSdGZc/MD0m3sferOkwWtp98bv+kcVfEHtRJgBVJzelrzg==}
dependencies:
globalyzer: 0.1.0
globrex: 0.1.2
=======
dev: false
/tinypool/0.1.2:
resolution: {integrity: sha512-fvtYGXoui2RpeMILfkvGIgOVkzJEGediv8UJt7TxdAOY8pnvUkFg/fkvqTfXG9Acc9S17Cnn1S4osDc2164guA==}
engines: {node: '>=14.0.0'}
@ -2411,7 +2366,6 @@ packages:
/tinyspy/0.2.10:
resolution: {integrity: sha512-Qij6rGWCDjWIejxCXXVi6bNgvrYBp3PbqC4cBP/0fD6WHDOHCw09Zd13CsxrDqSR5PFq01WeqDws8t5lz5sH0A==}
engines: {node: '>=14.0.0'}
>>>>>>> master
dev: false
/to-regex-range/5.0.1:
@ -2557,8 +2511,8 @@ packages:
optionalDependencies:
fsevents: 2.3.2
/vitest/0.3.2:
resolution: {integrity: sha512-Xc0u8BVPBdD029uDcLSYDvy1MFenC6V8WvTJOGdld6NNWgz/swgsMvwZNzftsDohmHLgDyck8A+TaQdDd1tNwA==}
/vitest/0.3.5:
resolution: {integrity: sha512-IIYupM5RAN9H44F5k/Yz0DEORHPJC8qwdi6sQmcdjrxqfxIHypq9PoutQQrW1WKW9O9yUNYG5VGHeHlqAXa9wg==}
engines: {node: '>=14.14.0'}
hasBin: true
peerDependencies:

View File

@ -16,8 +16,13 @@ from gradio.outputs import OutputComponent
GRADIO_DIR = "../../"
GRADIO_GUIDES_DIR = os.path.join(GRADIO_DIR, "guides")
GRADIO_DEMO_DIR = os.path.join(GRADIO_DIR, "demo")
GRADIO_ASSETS_LIST = os.listdir(os.path.join(GRADIO_DIR, "gradio", "templates", "frontend", "assets"))
GRADIO_ASSETS = {f"{asset.split('.')[0]}_{asset.split('.')[-1]}_file": asset for asset in GRADIO_ASSETS_LIST}
GRADIO_ASSETS_LIST = os.listdir(
os.path.join(GRADIO_DIR, "gradio", "templates", "frontend", "assets")
)
GRADIO_ASSETS = {
f"{asset.split('.')[0]}_{asset.split('.')[-1]}_file": asset
for asset in GRADIO_ASSETS_LIST
}
with open("src/navbar.html", encoding="utf-8") as navbar_file:
navbar_html = navbar_file.read()
@ -36,7 +41,10 @@ def render_index():
with open("src/index_template.html", encoding="utf-8") as template_file:
template = Template(template_file.read())
output_html = template.render(
tweets=tweets, star_count=star_count, navbar_html=navbar_html, **GRADIO_ASSETS
tweets=tweets,
star_count=star_count,
navbar_html=navbar_html,
**GRADIO_ASSETS,
)
with open(
os.path.join("generated", "index.html"), "w", encoding="utf-8"
@ -147,13 +155,19 @@ def render_guides():
guide_output,
)
copy_button = "<button class='copy flex float-right cursor-pointer rounded-l-none rounded-r mx-0 my-2' " \
"onclick='copyCode(this)'><img class='copy-svg m0 w-7 flex-initial' " \
"src='/assets/img/copy-grey.svg'><div class='flex-auto'></div></button>"
guide_output = guide_output.replace("<pre>", "<div class='code-block' style='display: flex'><pre>")
copy_button = (
"<button class='copy flex float-right cursor-pointer rounded-l-none rounded-r mx-0 my-2' "
"onclick='copyCode(this)'><img class='copy-svg m0 w-7 flex-initial' "
"src='/assets/img/copy-grey.svg'><div class='flex-auto'></div></button>"
)
guide_output = guide_output.replace(
"<pre>", "<div class='code-block' style='display: flex'><pre>"
)
guide_output = guide_output.replace("</pre>", f"</pre>{copy_button}</div>")
output_html = markdown2.markdown(guide_output, extras=["target-blank-links", "header-ids"])
output_html = markdown2.markdown(
guide_output, extras=["target-blank-links", "header-ids"]
)
os.makedirs("generated", exist_ok=True)
os.makedirs(os.path.join("generated", guide["name"]), exist_ok=True)
with open(
@ -174,7 +188,7 @@ def render_guides():
guide_name=guide["name"],
spaces=guide["spaces"],
tags=guide["tags"],
**GRADIO_ASSETS
**GRADIO_ASSETS,
)
generated_template.write(output_html)