mrcuddle commited on
Commit
9867227
·
verified ·
1 Parent(s): 2aa733e

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +96 -0
app.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import panel as pn
2
+ from transformers_agent_ui import TransformersAgentUI
3
+ from huggingface_hub import HfApi
4
+
5
+ # Load the model list from the script
6
+ model_list = [
7
+ "LayoutLMv3",
8
+ "LayoutXLM",
9
+ "LED",
10
+ "LeViT",
11
+ "LiLT",
12
+ "LLaMA",
13
+ "Llama2",
14
+ "Llama3",
15
+ "LLaVa",
16
+ "LLaVA-NeXT",
17
+ "LLaVA-NeXT-Video",
18
+ "LLaVA-Onevision",
19
+ "Longformer",
20
+ "LongT5",
21
+ "LUKE",
22
+ "LXMERT",
23
+ "M-CTC-T",
24
+ "M2M100",
25
+ "MADLAD-400",
26
+ "Mamba",
27
+ "mamba2",
28
+ "Marian",
29
+ "MarkupLM",
30
+ "Mask2Former",
31
+ "MaskFormer",
32
+ "MatCha",
33
+ "mBART",
34
+ "mBART-50",
35
+ "MEGA",
36
+ "Megatron-BERT",
37
+ "Megatron-GPT2",
38
+ "MGP-STR",
39
+ "Mimi",
40
+ "Mistral",
41
+ "Mixtral",
42
+ "Mllama",
43
+ "mLUKE",
44
+ "MMS",
45
+ "MobileBERT",
46
+ "MobileNetV1",
47
+ "MobileNetV2",
48
+ "MobileViT",
49
+ "MobileViTV2",
50
+ "Moshi",
51
+ "MPNet",
52
+ "MPT",
53
+ "MRA",
54
+ "MT5",
55
+ "MusicGen",
56
+ ]
57
+
58
+ # Create a dropdown menu for model selection
59
+ model_selector = pn.widgets.Select(options=model_list, value=model_list[0])
60
+
61
+ # Create a text input for the repository list file
62
+ repo_list_file = pn.widgets.TextInput(value="repo_list.txt")
63
+
64
+ # Create a text input for the output directory
65
+ output_dir = pn.widgets.TextInput(value="output_dir")
66
+
67
+ # Create a checkbox for dry run
68
+ dry_run = pn.widgets.Checkbox(value=False)
69
+
70
+ # Create a button to start the process
71
+ start_button = pn.widgets.Button(name="Start")
72
+
73
+ # Define the function to be executed when the button is clicked
74
+ def start_process(event):
75
+ # Get the selected model and repository list file
76
+ model = model_selector.value
77
+ repo_list_file_path = repo_list_file.value
78
+ output_dir_path = output_dir.value
79
+ dry_run_value = dry_run.value
80
+
81
+ # Call the script with the selected options
82
+ process_repos(output_dir_path, model, repo_list_file_path, dry_run_value)
83
+
84
+ # Link the button to the function
85
+ start_button.on_click(start_process)
86
+
87
+ # Create the UI
88
+ ui = pn.Column(
89
+ pn.Row(model_selector, repo_list_file, output_dir, dry_run),
90
+ start_button,
91
+ )
92
+
93
+ # Serve the UI
94
+ if pn.state.served:
95
+ pn.extension("terminal", "notifications", notifications=True, design="bootstrap")
96
+ ui.servable()