|
19 | 19 |
|
20 | 20 | def generate_model_docs(filename="model-service~available-models.md"): |
21 | 21 | """ |
22 | | - Generate output/available-models.md page for documentation website. |
| 22 | + Generate the available-models.md page for the documentation. |
| 23 | +
|
| 24 | + - Start from the _input/model-service~available-models.md template |
| 25 | + - Load the models.csv file from _input/models.csv |
| 26 | + - Scrape the README.md files from the GitHub repositories listed in models.csv |
| 27 | + - Generate overview markdown for each model |
| 28 | + - Store result in _output/docs/model-service~available-models.md |
| 29 | +
|
| 30 | + Note: The copy_docs script will interpret the ~ in the filename to know |
| 31 | + the path in the /docs directory where to copy the file to. |
23 | 32 | """ |
24 | 33 |
|
25 | 34 | output_text( |
26 | 35 | f"<h1>Generating <yellow>{filename}</yellow> from input/models.csv</h1>", |
27 | 36 | pad_top=2, |
28 | 37 | ) |
29 | 38 |
|
| 39 | + # Read commands.md input content |
| 40 | + available_models_md = read_input_file(filename) |
| 41 | + |
| 42 | + # Insert DO NOT EDIT comment |
| 43 | + available_models_md = re.sub( |
| 44 | + r"{{DO_NOT_EDIT}}", DO_NOT_EDIT, available_models_md, flags=re.DOTALL |
| 45 | + ) |
| 46 | + |
| 47 | + # Scrape README.md files from GitHub |
30 | 48 | model_data = scrape_repos() |
31 | 49 | if not model_data: |
32 | 50 | return |
33 | | - # print(model_data) |
| 51 | + |
| 52 | + # Generate markdown |
34 | 53 | markdown = generate_md(model_data) |
35 | | - markdown = DO_NOT_EDIT + "\n\n# Publicly Available Models\n\n" + markdown |
36 | | - write_output_file("docs/" + filename, markdown) |
| 54 | + |
| 55 | + # Insert in template and save |
| 56 | + available_models_md = available_models_md + "\n\n" + markdown |
| 57 | + write_output_file("docs/" + filename, available_models_md) |
37 | 58 |
|
38 | 59 | # for model in model_data: |
39 | 60 | # output_text(f"<yellow>Name:</yellow> {model['name']}", pad_top=1) |
@@ -213,16 +234,16 @@ def generate_md(model_data): |
213 | 234 | if model["support:compose"] |
214 | 235 | else "--REMOVE-LINE--" |
215 | 236 | ) |
216 | | - instructions_url_container = "/docs/model-service/prepackaged-models/#deployment-via-container" |
217 | | - instructions_url_compose = "/docs/model-service/prepackaged-models/#deployment-via-container-composeyml" |
| 237 | + instructions_url_container = "/docs/model-service/deploying-models/#deployment-via-container" |
| 238 | + instructions_url_compose = "/docs/model-service/deploying-models/#deployment-via-container-composeyaml-recommended" |
218 | 239 | instructions_url = instructions_url_compose if model["support:compose"] else instructions_url_container |
219 | 240 | btn_instructions = f"[Instructions]({instructions_url}){{ .md-button .md-button--tertiary }} " |
220 | 241 | support_overview = ( |
221 | 242 | f"\n" |
222 | 243 | "Support for: \n" |
223 | 244 | f"{'❌' if not model['support:compose'] else '✅'} Docker / Podman Compose \n" |
224 | 245 | f"{'❌' if not model['support:docker'] else '✅'} Docker / Podman \n" |
225 | | - f"{'❌' if model['support:apple-silicon'] is False else '❓' if model['support:apple-silicon'] is None else '✅'} Apple Silicon - [more info](/docs/model-service/prepackaged-models/#apple-silicon) \n" |
| 246 | + f"{'❌' if model['support:apple-silicon'] is False else '❓' if model['support:apple-silicon'] is None else '✅'} Apple Silicon - [more info](/docs/model-service/deploying-models#apple-silicon) \n" |
226 | 247 | f"\n" |
227 | 248 | ) |
228 | 249 | # fmt:on |
@@ -277,7 +298,7 @@ def generate_md(model_data): |
277 | 298 |
|
278 | 299 | # Compile |
279 | 300 | html_block = [ |
280 | | - f"<details markdown><summary><h3>{title}</h3></summary>", |
| 301 | + f"<details markdown><summary><h4>{title}</h4></summary>", |
281 | 302 | "<div markdown>", |
282 | 303 | "", |
283 | 304 | # Buttons |
|
0 commit comments