Problem showing mp4 examples on Spaces
Hi,I have a problem with Gradio and HuggingFace Spaces.The problem is that when I try to set examples in this way:intput_components = [
        input_video,
        dd_model,
        features,
        dd_track_points,
        slide_threshold,
    ]

output_components = "playablevideo"

example_list = [["examples/" + example] for example in os.listdir("examples")]

iface = gr.Interface(
    fn=inference,
    inputs=intput_components,
    outputs=output_components,
    examples=example_list,
)

iface.launch()where each element of the input_components list is a Gradio component.When I run this code locally I do not have any problems showing the examples (mp4 videos).I have Git LFS set properly.This is the error that the logs show me when I run this code on Spaces, but if I remove the attribute examples there is no error in that execution. For this reason, I do not understand the error and there is any possibility of a bug on the deploy process.Traceback (most recent call last):
  File "app.py", line 40, in <module>
    iface = gr.Interface(
  File "/home/user/.local/lib/python3.8/site-packages/gradio/interface.py", line 626, in __init__
    self.examples_handler = Examples(
  File "/home/user/.local/lib/python3.8/site-packages/gradio/examples.py", line 56, in create_examples
    utils.synchronize_async(examples_obj.create)
  File "/home/user/.local/lib/python3.8/site-packages/gradio/utils.py", line 364, in synchronize_async
    return fsspec.asyn.sync(fsspec.asyn.get_loop(), func, *args, **kwargs)
  File "/home/user/.local/lib/python3.8/site-packages/fsspec/asyn.py", line 96, in sync
    raise return_result
  File "/home/user/.local/lib/python3.8/site-packages/fsspec/asyn.py", line 53, in _runner
    result[0] = await coro
  File "/home/user/.local/lib/python3.8/site-packages/gradio/examples.py", line 208, in create
    await self.cache_interface_examples()
  File "/home/user/.local/lib/python3.8/site-packages/gradio/examples.py", line 246, in cache_interface_examples
    prediction = await self.predict_example(example_id)
  File "/home/user/.local/lib/python3.8/site-packages/gradio/examples.py", line 263, in predict_example
    predictions = await anyio.to_thread.run_sync(self.fn, *processed_input)
  File "/home/user/.local/lib/python3.8/site-packages/anyio/to_thread.py", line 31, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/home/user/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 937, in run_sync_in_worker_thread
    return await future
  File "/home/user/.local/lib/python3.8/site-packages/anyio/_backends/_asyncio.py", line 867, in run
    result = context.run(func, *args)
TypeError: inference() missing 4 required positional arguments: 'model', 'features', 'track_points', and 'model_threshold'
2022-09-12T08:30:14Z
Hello@diegofernandezc,Do you still have issues with your space ? Is so could you provide the link to the space ?
2022-09-12T12:39:28Z
Hello@chris-rannouThis is the space:Norfair - a Hugging Face Space by tryolabs
2022-09-12T14:36:47Z
I can confirm the examples files are included in the deployed space.I tried and submit one of themnorfair_demo.mp4which worked as expected.Did you check the gradio version locally matches the one for the space ?Could you try adding the examples with an absolute path ? (/home/user/app/examples)
2022-09-12T14:46:58Z
@diegofernandezcCan you try settingcache_examples=Falsein the interface init? This is a bug in gradio. By default on spaces, gradio will try to cache the example outputs but that will not work if only some of the inputs are provided as examples.
2022-09-12T15:20:09Z
Thanks@freddyaboultonthis was the solution to my problem.Greetings.
2022-09-12T15:21:27Z
Thanks for the reply@chris-rannou, the solution was the@freddyaboultonreply.Greetings.
2022-09-15T17:57:58Z
Hi again@chris-rannou@freddyaboultonI fixed this problem by setting default arguments to the function called by the interface.This function fails withcache_examples=Truebecause when the app starts it doesn’t receive any arguments to run over the example videos.Greetings.
2022-09-15T18:50:52Z
Thanks@diegofernandezc! I filed this github issue a couple of days ago to provide a clearer error message in this case:Interfaces which provide partial examples will crash on Spaces · Issue #2239 · gradio-app/gradio · GitHub