gradio-app/gradio

Fix ValueErrors for gradio/demo/random_demos.py

Closed this issue · 0 comments

Describe the bug

The random_demos.py script will throw ValueErrors when it tries to remove directories it doesn't find.
There are 2 reasons the directories are not found:

  1. The script hardcodes an assumption that it's being run specifically from the gradio/demo directory.
  2. The script hardcodes an assumption that there are 3 specific directories that are unwanted.

Fixing (1) still leaves you with the issue of (2).
The ValueError for (1) refers to 'streaming_wav2vec' and the ValueError for (2) refers to '.gradio/flagged' (log below)

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

Screenshot

No response

Logs

(.venv) (base) me@my-computer gradio % python demo/random_demos.py 2
Traceback (most recent call last):
  File "/Users/margaretmitchell/HuggingFace/git/gradio/demo/random_demos.py", line 27, in <module>
    demos_list.remove('streaming_wav2vec')
ValueError: list.remove(x): x not in list

And then going to the correct directory that's currently assumed (demo), I get the same error when the program tries to remove `.gradio/flagged`

System Info

From cloned git repo, most recent commit: c0cf80bddd99ad0f836e618cc3d2b13e73cb5611

Severity

I can work around it