Silverbelt commited on
Commit
287e695
1 Parent(s): c9e4995

script for updating models in the readme and updated README.md

Browse files
Files changed (2) hide show
  1. README.md +18 -13
  2. scripts/write-models-into-readme.py +40 -0
README.md CHANGED
@@ -16,21 +16,26 @@ In this repository some images with very different styles get upscaled with diff
16
 
17
  The tested upscalers are:
18
  <!-- BEGIN MODEL LINKS -->
19
- - [4xLexicaDAT2_otf](https://openmodeldb.info/models/4x-LexicaDAT2-otf) (DAT)
20
- - [4xFaceUpDAT](https://openmodeldb.info/models/4x-FaceUpDAT) (DAT)
21
- - [4xFaceUpSharpDAT](https://openmodeldb.info/models/4x-FaceUpSharpDAT) (DAT)
22
- - [4xfoolhardy_Remacri](https://openmodeldb.info/models/4x-Remacri) (ESRGAN/BSRGAN)
23
- - [4x_NMKD-Siax_200k](https://openmodeldb.info/models/4x-NMKD-Siax-CX)
24
- - [4xNMKD-Superscale-SP_178000_G](https://openmodeldb.info/models/4x-NMKD-Superscale) (ESRGAN)
25
- - [4xNomos8k_atd_jpg](https://openmodeldb.info/models/4x-Nomos8k-atd-jpg)
26
- - [4xNomos8kDAT](https://openmodeldb.info/models/4x-Nomos8kDAT) (DAT)
27
- - [4x-Nomos8kSCHAT-L](https://openmodeldb.info/models/4x-Nomos8kSCHAT-L) (HAT-L)
28
- - [4x-NomosUniDAT-otf](https://openmodeldb.info/models/4x-NomosUniDAT-otf) (DAT)
29
- - [4x-NomosUniDAT2-box](https://openmodeldb.info/models/4x-NomosUniDAT2-box) (DAT)
30
- - [4xRealWebPhoto_v3_atd](https://openmodeldb.info/models/4x-RealWebPhoto-v3-atd) (ATD)
 
 
 
 
 
 
31
  - [4x-UltraSharp](https://openmodeldb.info/models/4x-UltraSharp)
32
  <!-- END MODEL LINKS -->
33
-
34
  More to come...
35
 
36
  If you would like to see your most beloved upscaler here, contact me. Contributions and PRs are always welcome!
 
16
 
17
  The tested upscalers are:
18
  <!-- BEGIN MODEL LINKS -->
19
+ - [4x-FaceUpDAT](https://openmodeldb.info/models/4x-FaceUpDAT)
20
+ - [4x-FaceUpSharpDAT](https://openmodeldb.info/models/4x-FaceUpSharpDAT)
21
+ - [4x-LexicaDAT2-otf](https://openmodeldb.info/models/4x-LexicaDAT2-otf)
22
+ - [4x-LSDIRplus](https://openmodeldb.info/models/4x-LSDIRplus)
23
+ - [4x-LSDIRplusN](https://openmodeldb.info/models/4x-LSDIRplusN)
24
+ - [4x-NMKD-Siax-CX](https://openmodeldb.info/models/4x-NMKD-Siax-CX)
25
+ - [4x-NMKD-Superscale](https://openmodeldb.info/models/4x-NMKD-Superscale)
26
+ - [4x-Nomos2-hq-mosr](https://openmodeldb.info/models/4x-Nomos2-hq-mosr)
27
+ - [4x-Nomos8k-atd-jpg](https://openmodeldb.info/models/4x-Nomos8k-atd-jpg)
28
+ - [4x-Nomos8kDAT](https://openmodeldb.info/models/4x-Nomos8kDAT)
29
+ - [4x-Nomos8kSCHAT-L](https://openmodeldb.info/models/4x-Nomos8kSCHAT-L)
30
+ - [4x-NomosUni-rgt-multijpg](https://openmodeldb.info/models/4x-NomosUni-rgt-multijpg)
31
+ - [4x-NomosUniDAT-bokeh-jpg](https://openmodeldb.info/models/4x-NomosUniDAT-bokeh-jpg)
32
+ - [4x-NomosUniDAT-otf](https://openmodeldb.info/models/4x-NomosUniDAT-otf)
33
+ - [4x-NomosUniDAT2-box](https://openmodeldb.info/models/4x-NomosUniDAT2-box)
34
+ - [4x-PurePhoto-span](https://openmodeldb.info/models/4x-PurePhoto-span)
35
+ - [4x-RealWebPhoto-v3-atd](https://openmodeldb.info/models/4x-RealWebPhoto-v3-atd)
36
+ - [4x-Remacri](https://openmodeldb.info/models/4x-Remacri)
37
  - [4x-UltraSharp](https://openmodeldb.info/models/4x-UltraSharp)
38
  <!-- END MODEL LINKS -->
 
39
  More to come...
40
 
41
  If you would like to see your most beloved upscaler here, contact me. Contributions and PRs are always welcome!
scripts/write-models-into-readme.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+
4
+ # Get the directory of the current script
5
+ script_dir = os.path.dirname(os.path.abspath(__file__))
6
+
7
+ # Define paths
8
+ model_dir = os.path.join(script_dir, '..', 'models')
9
+ markdown_file = os.path.join(script_dir, '..', 'README.md')
10
+
11
+ # Define HTML comments as markers
12
+ begin_marker = "<!-- BEGIN MODEL LINKS -->"
13
+ end_marker = "<!-- END MODEL LINKS -->"
14
+
15
+ # Generate links
16
+ links = []
17
+ for file_name in os.listdir(model_dir):
18
+ if file_name.endswith(".json"): # Check if the file is a JSON file
19
+ base_name = os.path.splitext(file_name)[0] # Extract the filename without extension
20
+ link = f" - [{base_name}](https://openmodeldb.info/models/{base_name})" # Create a markdown link
21
+ links.append(link)
22
+
23
+ # Read the markdown file content
24
+ with open(markdown_file, 'r') as file:
25
+ content = file.read()
26
+
27
+ # Find the start and end of the marker section
28
+ begin_idx = content.find(begin_marker) + len(begin_marker)
29
+ end_idx = content.find(end_marker)
30
+
31
+ if begin_idx != -1 and end_idx != -1: # Ensure markers are found
32
+ # Replace the old content between the markers with the new links
33
+ new_content = content[:begin_idx] + "\n" + "\n".join(links) + "\n" + content[end_idx:]
34
+
35
+ # Write the updated content back to the markdown file
36
+ with open(markdown_file, 'w') as file:
37
+ file.write(new_content)
38
+ print("Markdown file has been updated.")
39
+ else:
40
+ print("Markers not found.")