gradio-app / gradio

Build and share delightful machine learning apps, all in Python. 🌟 Star to support our work!
http://www.gradio.app
Apache License 2.0
33.41k stars 2.52k forks source link

Render complex Latex formulas #5362

Closed Caldo123 closed 1 year ago

Caldo123 commented 1 year ago

Describe the bug

Simple formulas like $1+1=2$ are correctly displayed, as well as the simple functions listed in https://katex.org/docs/supported like $\left(\LARGE{AB}\right)$. However more complex functions listed on the same link, like arrays, do not seem to work, for example:

\begin{pmatrix} a & b \ c & d \end{pmatrix}

Have you searched existing issues? 🔎

Reproduction

import gradio as gr

string = r'''$\begin{pmatrix} a & b \ c & d \end{pmatrix}$'''

with gr.Blocks() as demo: gr.Markdown(string, latex_delimiters=[{ "left": "$", "right": "$", "display": False }])

demo.queue().launch()

Screenshot

No response

Logs

NA. Code is working but the formatting of the array is not correct.

System Info

Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 3.41.2
gradio_client version: 0.5.0

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
altair: 4.2.2
fastapi: 0.103.0
ffmpy: 0.3.1
gradio-client==0.5.0 is not installed.
httpx: 0.24.1
huggingface-hub: 0.16.4
importlib-resources: 6.0.1
jinja2: 3.1.2
markupsafe: 2.1.3
matplotlib: 3.7.1
numpy: 1.23.5
orjson: 3.9.5
packaging: 23.1
pandas: 1.5.3
pillow: 9.4.0
pydantic: 2.2.1
pydub: 0.25.1
python-multipart: 0.0.6
pyyaml: 6.0.1
requests: 2.31.0
semantic-version: 2.10.0
typing-extensions: 4.7.1
uvicorn: 0.23.2
websockets: 11.0.3
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.

gradio_client dependencies in your environment:

fsspec: 2023.6.0
httpx: 0.24.1
huggingface-hub: 0.16.4
packaging: 23.1
requests: 2.31.0
typing-extensions: 4.7.1
websockets: 11.0.3

Severity

Blocking usage of gradio

abidlabs commented 1 year ago

Thanks @Caldo123 I think this is related to #5356, I believe the new lines in the string are messing up the latex rendering

abidlabs commented 1 year ago

Once #5368 is merged, you'll be able to do this but you'll need to add a couple more backslashes to your latex to indicate a new line. Something like this:

markdown = r"""$$
\\begin{pmatrix}
   a & b \\\\
   c & d
\\end{pmatrix}
$$
"""

with gr.Blocks() as demo:
    gr.Markdown(markdown, latex_delimiters=[{ "left": "$$", "right": "$$", "display": True }])
demo.queue().launch()
Caldo123 commented 1 year ago

Thank you for the prompt feedback. I installed the version of the pull request (log below) and when using your example above (with double slash per slash) I am still getting the following output instead of the correctly formatted array: $$ \begin{pmatrix} a & b \ c & d \end{pmatrix} $$

Note that I use Google Colab.

Would you mind confirming that it is working on your end? Many thanks.

######################### log:

Collecting gradio==3.41.2 Downloading https://gradio-builds.s3.amazonaws.com/1603794cc0a2815cab42eba0377b0810c74d2b5a/gradio-3.41.2-py3-none-any.whl (10.3 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.3/10.3 MB 16.5 MB/s eta 0:00:00 Requirement already satisfied: aiofiles<24.0,>=22.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (23.2.1) Requirement already satisfied: altair<6.0,>=4.2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (4.2.2) Requirement already satisfied: fastapi in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (0.103.0) Requirement already satisfied: ffmpy in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (0.3.1) Requirement already satisfied: gradio-client==0.5.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (0.5.0) Requirement already satisfied: httpx in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (0.24.1) Requirement already satisfied: huggingface-hub>=0.14.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (0.16.4) Requirement already satisfied: importlib-resources<7.0,>=1.3 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (6.0.1) Requirement already satisfied: jinja2<4.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (3.1.2) Requirement already satisfied: markupsafe~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (2.1.3) Requirement already satisfied: matplotlib~=3.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (3.7.1) Requirement already satisfied: numpy~=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (1.23.5) Requirement already satisfied: orjson~=3.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (3.9.5) Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (23.1) Requirement already satisfied: pandas<3.0,>=1.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (1.5.3) Requirement already satisfied: pillow<11.0,>=8.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (9.4.0) Requirement already satisfied: pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (2.2.1) Requirement already satisfied: pydub in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (0.25.1) Requirement already satisfied: python-multipart in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (0.0.6) Requirement already satisfied: pyyaml<7.0,>=5.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (6.0.1) Requirement already satisfied: requests~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (2.31.0) Requirement already satisfied: semantic-version~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (2.10.0) Requirement already satisfied: typing-extensions~=4.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (4.7.1) Requirement already satisfied: uvicorn>=0.14.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (0.23.2) Requirement already satisfied: websockets<12.0,>=10.0 in /usr/local/lib/python3.10/dist-packages (from gradio==3.41.2) (11.0.3) Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from gradio-client==0.5.0->gradio==3.41.2) (2023.6.0) Requirement already satisfied: entrypoints in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.41.2) (0.4) Requirement already satisfied: jsonschema>=3.0 in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.41.2) (4.19.0) Requirement already satisfied: toolz in /usr/local/lib/python3.10/dist-packages (from altair<6.0,>=4.2.0->gradio==3.41.2) (0.12.0) Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio==3.41.2) (3.12.2) Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.14.0->gradio==3.41.2) (4.66.1) Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.41.2) (1.1.0) Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.41.2) (0.11.0) Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.41.2) (4.42.1) Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.41.2) (1.4.4) Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.41.2) (3.1.1) Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib~=3.0->gradio==3.41.2) (2.8.2) Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas<3.0,>=1.0->gradio==3.41.2) (2023.3) Requirement already satisfied: annotated-types>=0.4.0 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio==3.41.2) (0.5.0) Requirement already satisfied: pydantic-core==2.6.1 in /usr/local/lib/python3.10/dist-packages (from pydantic!=1.8,!=1.8.1,!=2.0.0,!=2.0.1,<3.0.0,>=1.7.4->gradio==3.41.2) (2.6.1) Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.41.2) (3.2.0) Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.41.2) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.41.2) (2.0.4) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio==3.41.2) (2023.7.22) Requirement already satisfied: click>=7.0 in /usr/local/lib/python3.10/dist-packages (from uvicorn>=0.14.0->gradio==3.41.2) (8.1.7) Requirement already satisfied: h11>=0.8 in /usr/local/lib/python3.10/dist-packages (from uvicorn>=0.14.0->gradio==3.41.2) (0.14.0) Requirement already satisfied: starlette<0.28.0,>=0.27.0 in /usr/local/lib/python3.10/dist-packages (from fastapi->gradio==3.41.2) (0.27.0) Requirement already satisfied: httpcore<0.18.0,>=0.15.0 in /usr/local/lib/python3.10/dist-packages (from httpx->gradio==3.41.2) (0.17.3) Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio==3.41.2) (1.3.0) Requirement already satisfied: anyio<5.0,>=3.0 in /usr/local/lib/python3.10/dist-packages (from httpcore<0.18.0,>=0.15.0->httpx->gradio==3.41.2) (3.7.1) Requirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.41.2) (23.1.0) Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.41.2) (2023.7.1) Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.41.2) (0.30.2) Requirement already satisfied: rpds-py>=0.7.1 in /usr/local/lib/python3.10/dist-packages (from jsonschema>=3.0->altair<6.0,>=4.2.0->gradio==3.41.2) (0.9.2) Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.7->matplotlib~=3.0->gradio==3.41.2) (1.16.0) Requirement already satisfied: exceptiongroup in /usr/local/lib/python3.10/dist-packages (from anyio<5.0,>=3.0->httpcore<0.18.0,>=0.15.0->httpx->gradio==3.41.2) (1.1.3) Collecting gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python Cloning https://github.com/gradio-app/gradio (to revision 1603794cc0a2815cab42eba0377b0810c74d2b5a) to /tmp/pip-install-s0_76agf/gradio-client_2728c861f6414c26a51035cf8f8b46a8 Running command git clone --filter=blob:none --quiet https://github.com/gradio-app/gradio /tmp/pip-install-s0_76agf/gradio-client_2728c861f6414c26a51035cf8f8b46a8 Running command git rev-parse -q --verify 'sha^1603794cc0a2815cab42eba0377b0810c74d2b5a' Running command git fetch -q https://github.com/gradio-app/gradio 1603794cc0a2815cab42eba0377b0810c74d2b5a Running command git checkout -q 1603794cc0a2815cab42eba0377b0810c74d2b5a Resolved https://github.com/gradio-app/gradio to commit 1603794cc0a2815cab42eba0377b0810c74d2b5a Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (2023.6.0) Requirement already satisfied: httpx in /usr/local/lib/python3.10/dist-packages (from gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (0.24.1) Requirement already satisfied: huggingface-hub>=0.13.0 in /usr/local/lib/python3.10/dist-packages (from gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (0.16.4) Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (23.1) Requirement already satisfied: requests~=2.0 in /usr/local/lib/python3.10/dist-packages (from gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (2.31.0) Requirement already satisfied: typing-extensions~=4.0 in /usr/local/lib/python3.10/dist-packages (from gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (4.7.1) Requirement already satisfied: websockets<12.0,>=10.0 in /usr/local/lib/python3.10/dist-packages (from gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (11.0.3) Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.13.0->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (3.12.2) Requirement already satisfied: tqdm>=4.42.1 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.13.0->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (4.66.1) Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.10/dist-packages (from huggingface-hub>=0.13.0->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (6.0.1) Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (3.2.0) Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (3.4) Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (2.0.4) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests~=2.0->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (2023.7.22) Requirement already satisfied: httpcore<0.18.0,>=0.15.0 in /usr/local/lib/python3.10/dist-packages (from httpx->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (0.17.3) Requirement already satisfied: sniffio in /usr/local/lib/python3.10/dist-packages (from httpx->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (1.3.0) Requirement already satisfied: h11<0.15,>=0.13 in /usr/local/lib/python3.10/dist-packages (from httpcore<0.18.0,>=0.15.0->httpx->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (0.14.0) Requirement already satisfied: anyio<5.0,>=3.0 in /usr/local/lib/python3.10/dist-packages (from httpcore<0.18.0,>=0.15.0->httpx->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (3.7.1) Requirement already satisfied: exceptiongroup in /usr/local/lib/python3.10/dist-packages (from anyio<5.0,>=3.0->httpcore<0.18.0,>=0.15.0->httpx->gradio-client@ git+https://github.com/gradio-app/gradio@1603794cc0a2815cab42eba0377b0810c74d2b5a#subdirectory=client/python) (1.1.3)

abidlabs commented 1 year ago

Hi @Caldo123 I just tested it on Colab and confirmed that it works. Here's the link to my Colab notebook:

https://colab.research.google.com/drive/1uDWvyKKxvktCPEDXCBViU4vMoZikAac3?usp=sharing

Caldo123 commented 1 year ago

Hi @abidlabs, thank you very much for your time, much appreciated. Unfortunately, running your code with debug=True, I get the following error:

ERROR: Exception in ASGI application Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/gradio/routes.py", line 282, in main return templates.TemplateResponse( File "/usr/local/lib/python3.10/dist-packages/starlette/templating.py", line 112, in TemplateResponse template = self.get_template(name) File "/usr/local/lib/python3.10/dist-packages/starlette/templating.py", line 94, in get_template return self.env.get_template(name) File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 1010, in get_template return self._load_template(name, globals) File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 969, in _load_template template = self.loader.load(self, name, self.make_globals(globals)) File "/usr/local/lib/python3.10/dist-packages/jinja2/loaders.py", line 126, in load source, filename, uptodate = self.get_source(environment, name) File "/usr/local/lib/python3.10/dist-packages/jinja2/loaders.py", line 218, in get_source raise TemplateNotFound(template) jinja2.exceptions.TemplateNotFound: frontend/share.html

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/uvicorn/protocols/http/h11_impl.py", line 408, in run_asgi result = await app( # type: ignore[func-returns-value] File "/usr/local/lib/python3.10/dist-packages/uvicorn/middleware/proxy_headers.py", line 84, in call return await self.app(scope, receive, send) File "/usr/local/lib/python3.10/dist-packages/fastapi/applications.py", line 292, in call await super().call(scope, receive, send) File "/usr/local/lib/python3.10/dist-packages/starlette/applications.py", line 122, in call await self.middleware_stack(scope, receive, send) File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 184, in call raise exc File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/errors.py", line 162, in call await self.app(scope, receive, _send) File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/cors.py", line 83, in call await self.app(scope, receive, send) File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 79, in call raise exc File "/usr/local/lib/python3.10/dist-packages/starlette/middleware/exceptions.py", line 68, in call await self.app(scope, receive, sender) File "/usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py", line 20, in call raise e File "/usr/local/lib/python3.10/dist-packages/fastapi/middleware/asyncexitstack.py", line 17, in call await self.app(scope, receive, send) File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 718, in call await route.handle(scope, receive, send) File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 276, in handle await self.app(scope, receive, send) File "/usr/local/lib/python3.10/dist-packages/starlette/routing.py", line 66, in app response = await func(request) File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 273, in app raw_response = await run_endpoint_function( File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 192, in run_endpoint_function return await run_in_threadpool(dependant.call, *values) File "/usr/local/lib/python3.10/dist-packages/starlette/concurrency.py", line 41, in run_in_threadpool return await anyio.to_thread.run_sync(func, args) File "/usr/local/lib/python3.10/dist-packages/anyio/to_thread.py", line 33, in run_sync return await get_asynclib().run_sync_in_worker_thread( File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread return await future File "/usr/local/lib/python3.10/dist-packages/anyio/_backends/_asyncio.py", line 807, in run result = context.run(func, *args) File "/usr/local/lib/python3.10/dist-packages/gradio/routes.py", line 288, in main raise ValueError( ValueError: Did you install Gradio from source files? Share mode only works when Gradio is installed through the pip package. ERROR: Exception in ASGI application Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/gradio/routes.py", line 282, in main return templates.TemplateResponse( File "/usr/local/lib/python3.10/dist-packages/starlette/templating.py", line 112, in TemplateResponse template = self.get_template(name) File "/usr/local/lib/python3.10/dist-packages/starlette/templating.py", line 94, in get_template return self.env.get_template(name) File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 1010, in get_template return self._load_template(name, globals) File "/usr/local/lib/python3.10/dist-packages/jinja2/environment.py", line 969, in _load_template template = self.loader.load(self, name, self.make_globals(globals)) File "/usr/local/lib/python3.10/dist-packages/jinja2/loaders.py", line 126, in load source, filename, uptodate = self.get_source(environment, name) File "/usr/local/lib/python3.10/dist-packages/jinja2/loaders.py", line 218, in get_source raise TemplateNotFound(template) jinja2.exceptions.TemplateNotFound: frontend/share.html

Caldo123 commented 1 year ago

It seems that Gradio can't find the necessary template file frontend/share.html

freddyaboulton commented 1 year ago

I don't see that when running the same notbook @Caldo123 !

image

If you are using the queue or setting share=True then that error is expected because the share.html is not generated for PR builds.

abidlabs commented 1 year ago

Yes exactly -- it'll be fixed when we release the next version of gradio to pypi.

Caldo123 commented 1 year ago

@freddyaboulton thank you for confirming that it is working for you. Yes I was using share=True because I get the following error otherwise:

image

I believe this is a known error that happens from time to time. Will try again tomorrow

freddyaboulton commented 1 year ago

We should have a release out with the fix you're interested in either tomorrow or friday @Caldo123 !

Caldo123 commented 1 year ago

Brilliant, looking forward

Yelrose commented 1 year ago

How to use this with chatbot?

Caldo123 commented 1 year ago

Quick feedback, I tried again the google colab and it is now working!

Do you have any plan to incorporate Latex into Textboxes in the near future?

abidlabs commented 1 year ago

How to use this with chatbot?

Have you tried to use it as is by updating the Colab? It should work since the gr.Chatbot uses the same latex processing. If you have furhter general questions like this (that are not feature requests or bug reports), please ask in our Forums or our Discord.

Do you have any plan to incorporate Latex into Textboxes in the near future?

No it would go beyond the functionality that the basic gr.Textbox is designed for. However, we are working on allowing developers to create custom components in case you wanted to create something like this!