# Problem showing mp4 examples on Spaces

**URL:** <https://discuss.huggingface.co/t/problem-showing-mp4-examples-on-spaces/22801>\
**Category:** Spaces\
**Created:** [September 8, 2022, 6:29pm UTC](https://discuss.huggingface.co/t/problem-showing-mp4-examples-on-spaces/22801 "2022-09-08T18:29:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![diegofernandezc](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@diegofernandezc](https://discuss.huggingface.co/u/diegofernandezc)\
**Post date:** [September 8, 2022, 6:29pm UTC](https://discuss.huggingface.co/t/problem-showing-mp4-examples-on-spaces/22801/1 "2022-09-08T18:29:57Z")

</div>

Hi,

I have a problem with Gradio and HuggingFace Spaces.  
The problem is that when I try to set examples in this way:

```auto
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.

```auto
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'

```

---

<div class="post-metadata">

**Author:** ![chris-rannou](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@chris-rannou](https://discuss.huggingface.co/u/chris-rannou)\
**Post date:** [September 12, 2022, 8:30am UTC](https://discuss.huggingface.co/t/problem-showing-mp4-examples-on-spaces/22801/2 "2022-09-12T08:30:14Z")

</div>

Hello @diegofernandezc,

Do you still have issues with your space ? Is so could you provide the link to the space ?

---

<div class="post-metadata">

**Author:** ![diegofernandezc](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@diegofernandezc](https://discuss.huggingface.co/u/diegofernandezc)\
**Post date:** [September 12, 2022, 12:39pm UTC](https://discuss.huggingface.co/t/problem-showing-mp4-examples-on-spaces/22801/3 "2022-09-12T12:39:28Z")

</div>

Hello @chris-rannou

This is the space: [Norfair - a Hugging Face Space by tryolabs](https://huggingface.co/spaces/tryolabs/norfair-demo)

---

<div class="post-metadata">

**Author:** ![chris-rannou](https://avatars.discourse-cdn.com/v4/letter/c/7feea3/32.png) [@chris-rannou](https://discuss.huggingface.co/u/chris-rannou)\
**Post date:** [September 12, 2022, 2:36pm UTC](https://discuss.huggingface.co/t/problem-showing-mp4-examples-on-spaces/22801/4 "2022-09-12T14:36:47Z")

</div>

I can confirm the examples files are included in the deployed space.  
I tried and submit one of them `norfair_demo.mp4` which 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`)

---

<div class="post-metadata">

**Author:** ![freddyaboulton](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/freddyaboulton/32/32732_2.png) [@freddyaboulton](https://discuss.huggingface.co/u/freddyaboulton)\
**Post date:** [September 12, 2022, 2:46pm UTC](https://discuss.huggingface.co/t/problem-showing-mp4-examples-on-spaces/22801/5 "2022-09-12T14:46:58Z")

</div>

@diegofernandezc Can you try setting `cache_examples=False` in 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.

---

<div class="post-metadata">

**Author:** ![diegofernandezc](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@diegofernandezc](https://discuss.huggingface.co/u/diegofernandezc)\
**Post date:** [September 12, 2022, 3:20pm UTC](https://discuss.huggingface.co/t/problem-showing-mp4-examples-on-spaces/22801/6 "2022-09-12T15:20:09Z")

</div>

Thanks @freddyaboulton this was the solution to my problem.

Greetings.

---

<div class="post-metadata">

**Author:** ![diegofernandezc](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@diegofernandezc](https://discuss.huggingface.co/u/diegofernandezc)\
**Post date:** [September 12, 2022, 3:21pm UTC](https://discuss.huggingface.co/t/problem-showing-mp4-examples-on-spaces/22801/7 "2022-09-12T15:21:27Z")

</div>

Thanks for the reply @chris-rannou, the solution was the @freddyaboulton reply.

Greetings.

---

<div class="post-metadata">

**Author:** ![diegofernandezc](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@diegofernandezc](https://discuss.huggingface.co/u/diegofernandezc)\
**Post date:** [September 15, 2022, 5:57pm UTC](https://discuss.huggingface.co/t/problem-showing-mp4-examples-on-spaces/22801/8 "2022-09-15T17:57:58Z")

</div>

Hi again @chris-rannou @freddyaboulton

I fixed this problem by setting default arguments to the function called by the interface.

This function fails with `cache_examples=True` because when the app starts it doesn’t receive any arguments to run over the example videos.

Greetings.

---

<div class="post-metadata">

**Author:** ![freddyaboulton](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/freddyaboulton/32/32732_2.png) [@freddyaboulton](https://discuss.huggingface.co/u/freddyaboulton)\
**Post date:** [September 15, 2022, 6:50pm UTC](https://discuss.huggingface.co/t/problem-showing-mp4-examples-on-spaces/22801/9 "2022-09-15T18:50:52Z")

</div>

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](https://github.com/gradio-app/gradio/issues/2239)
