mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
dbb7373dde
* changes * changes * more fix * more fix * add changeset * fix initial crop * fix format * fix format * fix formats * faster? * race condition * fixes + test * fix type? * notebooks * fix type * change demo * add changeset * fix type * fix type * fix type again * fix type again again * lint * lint again * fix test * tests * fix * tests * address comments * fix notebooks * fix tests * fix stories * fix webcam ui * cleanup * add changeset * fix input event * add format param + fix input event * fix test --------- Co-authored-by: gradio-pr-bot <gradio-pr-bot@users.noreply.github.com> Co-authored-by: Abubakar Abid <abubakar@huggingface.co>
80 lines
2.2 KiB
Python
80 lines
2.2 KiB
Python
import argparse
|
|
import os
|
|
import pathlib
|
|
import shutil
|
|
import textwrap
|
|
|
|
|
|
def copy_all_demos(source_dir: str, dest_dir: str):
|
|
demos_to_copy = [
|
|
"audio_debugger",
|
|
"altair_plot",
|
|
"blocks_essay",
|
|
"blocks_group",
|
|
"blocks_js_methods",
|
|
"blocks_layout",
|
|
"blocks_multiple_event_triggers",
|
|
"blocks_update",
|
|
"calculator",
|
|
"cancel_events",
|
|
"chatbot_multimodal",
|
|
"chatinterface_streaming_echo",
|
|
"clear_components",
|
|
"code",
|
|
"fake_gan",
|
|
"fake_diffusion_with_gif",
|
|
"file_explorer_component_events",
|
|
"image_mod_default_image",
|
|
"image_editor_events",
|
|
"image_segmentation",
|
|
"interface_random_slider",
|
|
"kitchen_sink",
|
|
"kitchen_sink_random",
|
|
"matrix_transpose",
|
|
"mini_leaderboard",
|
|
"model3D",
|
|
"native_plots",
|
|
"reverse_audio",
|
|
"stt_or_tts",
|
|
"stream_audio",
|
|
"stream_frames",
|
|
"video_component",
|
|
"zip_files",
|
|
]
|
|
for demo in demos_to_copy:
|
|
shutil.copytree(
|
|
os.path.join(source_dir, demo),
|
|
os.path.join(dest_dir, demo),
|
|
dirs_exist_ok=True,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
parser = argparse.ArgumentParser(
|
|
description="Copy all demos to all_demos and update requirements"
|
|
)
|
|
parser.add_argument("gradio_version", type=str, help="Gradio")
|
|
parser.add_argument("gradio_client_version", type=str, help="Gradio Client Version")
|
|
args = parser.parse_args()
|
|
|
|
source_dir = pathlib.Path(pathlib.Path(__file__).parent, "..", "demo")
|
|
dest_dir = pathlib.Path(
|
|
pathlib.Path(__file__).parent, "..", "demo", "all_demos", "demos"
|
|
)
|
|
copy_all_demos(source_dir, dest_dir)
|
|
reqs_file_path = pathlib.Path(
|
|
pathlib.Path(__file__).parent, "..", "demo", "all_demos", "requirements.txt"
|
|
)
|
|
requirements = f"""
|
|
{args.gradio_client_version}
|
|
{args.gradio_version}
|
|
pypistats==1.1.0
|
|
plotly==5.10.0
|
|
opencv-python==4.6.0.66
|
|
transformers==4.21.1
|
|
torch==1.12.1
|
|
altair
|
|
vega_datasets
|
|
"""
|
|
open(reqs_file_path, "w").write(textwrap.dedent(requirements))
|