Unkown Type Error in Space

Hi There,

I made a Space a while ago (Transformers Can Do Bayesian Inference - a Hugging Face Space by samuelinferences). It was great and worked well. Then, suddenly it did not work anymore. I did not change a thing in the mean time.

The error, I get is

Running on local URL:  http://localhost:7860/

To create a public link, set `share=True` in `launch()`.
Traceback (most recent call last):
  File "/home/user/.local/lib/python3.8/site-packages/gradio/routes.py", line 269, in predict
    output = await run_in_threadpool(app.launchable.process_api, body, username)
  File "/home/user/.local/lib/python3.8/site-packages/starlette/concurrency.py", line 39, in run_in_threadpool
    return await anyio.to_thread.run_sync(func, *args)
  File "/home/user/.local/lib/python3.8/site-packages/anyio/to_thread.py", line 28, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(func, *args, cancellable=cancellable,
  File "/home/user/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 818, in run_sync_in_worker_thread
    return await future
  File "/home/user/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 754, in run
    result = context.run(func, *args)
  File "/home/user/.local/lib/python3.8/site-packages/gradio/interface.py", line 573, in process_api
    prediction, durations = self.process(raw_input)
  File "/home/user/.local/lib/python3.8/site-packages/gradio/interface.py", line 618, in process
    processed_output = [
  File "/home/user/.local/lib/python3.8/site-packages/gradio/interface.py", line 619, in <listcomp>
    output_component.postprocess(predictions[i])
  File "/home/user/.local/lib/python3.8/site-packages/gradio/outputs.py", line 908, in postprocess
    raise ValueError(
ValueError: Unknown type. Please choose from: 'plotly', 'matplotlib', 'bokeh'.

I don’t understand this error and think it is internal actually. I tried to fix the gradio version to the version likely used back then, but that did not help either. Any ideas? Can’t find this in the current codebase of gradio either.

Hello and welcome to our Forum :hugs:

Gradio has recently added support for different plotting libraries. You should define the plot as:
plot = gr.outputs.Plot(type="bokeh") (or pick Plotly or Matplotlib) and pass it to the inferface :slight_smile:

1 Like

FYI we now also automatically set the sdk_version in the README.md to pin a version of Gradio. You might want to add it as well. Here is an example README.md · ysharma/text-to-ner-to-image-to-video at main

1 Like

Thank You! This fixed it :slight_smile:

That would be good to do, do you know where to find the version currently used by a space?

If it’s not specified, you are using the latest gradio version which is 2.9.4 if I recall correctly.