gradio/js/app/test/create_demo_configs.py
pngwn ae4277a9a8
move files (#3605)
* move files

* commit the rest of the files

* fix lockfile

* fix workflow

* fix type errors

* fix tests

* only run ci when certain files change

* run correct test command in ci

* version

* fix pypi script

---------

Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
2023-03-27 16:12:58 -07:00

26 lines
722 B
Python

import os
import subprocess
demo_names = set()
snapshots_dir = os.path.join(os.path.dirname(__file__), "../snapshots")
for f in os.listdir(os.path.dirname(__file__)):
if ".spec.ts" in f:
demo_names.add(f.split(".")[0])
for f in os.listdir(snapshots_dir):
if ".spec.ts" in f and not os.path.isdir(os.path.join(snapshots_dir, f)):
demo_names.add(f.split(".")[0])
for demo in demo_names:
print("Generating demo: " + demo)
command = (
f"python ../../../demo/write_config.py {demo} ../../../demo/{demo}/config.json"
)
process = subprocess.Popen(
command.split(), stdout=subprocess.PIPE, cwd=os.path.dirname(__file__)
)
output, error = process.communicate()