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

3229 styling #3233

Merged
merged 11 commits into from
Feb 19, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ By [@dawoodkhan82](https://github.com/dawoodkhan82) in [PR 3165](https://github.
* Support Chinese pinyin in Dataframe by [@aliabid94](https://github.com/aliabid94) in [PR 3206](https://github.com/gradio-app/gradio/pull/3206)
* The `clear` event is now triggered when images are cleared by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 3218](https://github.com/gradio-app/gradio/pull/3218)
* Fix bug where auth cookies where not sent when connecting to an app via http by [@freddyaboulton](https://github.com/freddyaboulton) in [PR 3223](https://github.com/gradio-app/gradio/pull/3223)
* Ensure latext CSS is always applied in light and dark mode by [@pngwn](https://github.com/pngwn) in [PR 3233](https://github.com/gradio-app/gradio/pull/3233)

## Documentation Changes:
* Sort components in docs by alphabetic order by [@aliabd](https://github.com/aliabd) in [PR 3152](https://github.com/gradio-app/gradio/pull/3152)
Expand Down
2 changes: 1 addition & 1 deletion demo/calculator/run.ipynb
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: calculator"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["# Downloading files from the demo repo\n", "import os\n", "os.mkdir('examples')\n", "!wget -q -O examples/log.csv https://github.com/gradio-app/gradio/raw/main/demo/calculator/examples/log.csv"]}, {"cell_type": "code", "execution_count": null, "id": 44380577570523278879349135829904343037, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "def calculator(num1, operation, num2):\n", " if operation == \"add\":\n", " return num1 + num2\n", " elif operation == \"subtract\":\n", " return num1 - num2\n", " elif operation == \"multiply\":\n", " return num1 * num2\n", " elif operation == \"divide\":\n", " if num2 == 0:\n", " raise gr.Error(\"Cannot divide by zero!\")\n", " return num1 / num2\n", "\n", "demo = gr.Interface(\n", " calculator,\n", " [\n", " \"number\", \n", " gr.Radio([\"add\", \"subtract\", \"multiply\", \"divide\"]),\n", " \"number\"\n", " ],\n", " \"number\",\n", " examples=[\n", " [5, \"add\", 3],\n", " [4, \"divide\", 2],\n", " [-4, \"multiply\", 2.5],\n", " [0, \"subtract\", 1.2],\n", " ],\n", " title=\"Toy Calculator\",\n", " description=\"Here's a sample toy calculator. Enjoy!\",\n", ")\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
{"cells": [{"cell_type": "markdown", "id": 302934307671667531413257853548643485645, "metadata": {}, "source": ["# Gradio Demo: calculator"]}, {"cell_type": "code", "execution_count": null, "id": 272996653310673477252411125948039410165, "metadata": {}, "outputs": [], "source": ["!pip install -q gradio "]}, {"cell_type": "code", "execution_count": null, "id": 288918539441861185822528903084949547379, "metadata": {}, "outputs": [], "source": ["# Downloading files from the demo repo\n", "import os\n", "os.mkdir('examples')\n", "!wget -q -O examples/log.csv https://github.com/gradio-app/gradio/raw/main/demo/calculator/examples/log.csv"]}, {"cell_type": "code", "execution_count": null, "id": 44380577570523278879349135829904343037, "metadata": {}, "outputs": [], "source": ["import gradio as gr\n", "\n", "def calculator(num1, operation, num2):\n", " if operation == \"add\":\n", " return num1 + num2\n", " elif operation == \"subtract\":\n", " return num1 - num2\n", " elif operation == \"multiply\":\n", " return num1 * num2\n", " elif operation == \"divide\":\n", " if num2 == 0:\n", " raise gr.Error(\"Cannot divide by zero!\")\n", " return num1 / num2\n", "\n", "demo = gr.Interface(\n", " calculator,\n", " [\n", " \"number\", \n", " gr.Radio([\"add\", \"subtract\", \"multiply\", \"divide\"]),\n", " \"number\"\n", " ],\n", " \"number\",\n", " examples=[\n", " [5, \"add\", 3],\n", " [4, \"divide\", 2],\n", " [-4, \"multiply\", 2.5],\n", " [0, \"subtract\", 1.2],\n", " ],\n", " title=\"Toy Calculator\",\n", " description=\"Here's a sample toy calculator. Allows you to calculate things like $2+2=4$\",\n", ")\n", "if __name__ == \"__main__\":\n", " demo.launch()\n"]}], "metadata": {}, "nbformat": 4, "nbformat_minor": 5}
2 changes: 1 addition & 1 deletion demo/calculator/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def calculator(num1, operation, num2):
[0, "subtract", 1.2],
],
title="Toy Calculator",
description="Here's a sample toy calculator. Enjoy!",
description="Here's a sample toy calculator. Allows you to calculate things like $2+2=4$",
)
if __name__ == "__main__":
demo.launch()
2 changes: 1 addition & 1 deletion gradio/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def clean_html(raw_html):
"html": True,
},
)
.use(dollarmath_plugin)
.use(dollarmath_plugin, renderer=utils.tex2svg, allow_digits=False)
.use(footnote_plugin)
.enable("table")
)
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ aiohttp
altair>=4.2.0
fastapi
ffmpy
markdown-it-py[linkify,plugins]>=2.0.0
markdown-it-py[linkify]>=2.0.0
mdit-py-plugins<=0.3.3
markupsafe
matplotlib
numpy
Expand Down
2 changes: 1 addition & 1 deletion ui/packages/app/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en" style="margin: 0; padding: 0; min-height: 100%; height: 100%">
<html lang="en" style="margin: 0; padding: 0; min-height: 100%">
<head>
<meta charset="utf-8" />
<meta
Expand Down
2 changes: 0 additions & 2 deletions ui/packages/app/src/Embed.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
<style>
.gradio-container {
position: relative;

background: var(--button-secondary-background-base);
background: var(--color-background-primary);
padding: 0;
Expand Down Expand Up @@ -110,7 +109,6 @@
position: absolute;
bottom: 0;
justify-content: flex-start;
z-index: var(--layer-top);
border-top: 1px solid var(--button-secondary-border-color-base);
padding: var(--size-1) var(--size-5);
width: 100%;
Expand Down
5 changes: 2 additions & 3 deletions ui/packages/app/src/Index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@
error_detail = {
type: "not_found",
detail: {
description: "This space is experiencing an issue."
description: "This gradio app is experiencing an issue."
}
};
}
Expand Down Expand Up @@ -450,7 +450,7 @@
> to let them know.
</p>
{:else}
<p>Please contact the author of the page to let them know</p>
<p>Please contact the author of the page to let them know.</p>
{/if}
</div>
</Loader>
Expand Down Expand Up @@ -480,7 +480,6 @@
<style>
.error {
position: relative;
z-index: var(--layer-top);
padding: var(--size-4);
color: var(--color-text-body);
text-align: center;
Expand Down
14 changes: 13 additions & 1 deletion ui/packages/markdown/src/Markdown.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script lang="ts">
import { createEventDispatcher } from "svelte";
import "./latex.css";
export let elem_id: string = "";
export let visible: boolean = true;
export let value: string;
Expand All @@ -25,9 +24,22 @@
</div>

<style>
div :global(.math.inline) {
fill: var(--color-text-body);
display: inline-block;
vertical-align: middle;
padding: var(--size-1-5) -var(--size-1);
color: var(--color-text-body);
}

div :global(.math.inline svg) {
display: inline;
}

div {
max-width: 100%;
}

.min {
min-height: var(--size-24);
}
Expand Down
13 changes: 0 additions & 13 deletions ui/packages/markdown/src/latex.css

This file was deleted.