SadP0i commited on
Commit
3c29f9f
1 Parent(s): 615c77c

Upload index.html

Browse files

Sanity check for the last sanity check

Files changed (1) hide show
  1. index.html +15 -6
index.html CHANGED
@@ -83,21 +83,30 @@
83
  '>': '>',
84
  '"': '"',
85
  "'": ''',
86
- "/": '/',
 
 
 
 
 
 
87
  };
88
- const reg = /[&<>"'/]/ig;
89
  return string.replace(reg, (match) => (map[match]));
90
  }
91
 
92
  async function modelConfig(hf_model) {
93
- let config = {}
 
94
 
95
  try {
96
- config = await fetch(
97
  `https://huggingface.co/${hf_model}/raw/main/config.json`
98
- ).then(r => r.json());
 
 
99
  } catch (err) {
100
- alert(sanitize(err));
101
  return config;
102
  }
103
 
 
83
  '>': '&gt;',
84
  '"': '&quot;',
85
  "'": '&#x27;',
86
+ "/": '_',
87
+ '(': '',
88
+ ')': '',
89
+ '{': '',
90
+ '}': '',
91
+ '[': '',
92
+ ']': '',
93
  };
94
+ const reg = /[&<>"'/\[\]\(\)\{\}]/ig;
95
  return string.replace(reg, (match) => (map[match]));
96
  }
97
 
98
  async function modelConfig(hf_model) {
99
+ let config = {};
100
+ let responseText;
101
 
102
  try {
103
+ let modelInfoPromise = fetch(
104
  `https://huggingface.co/${hf_model}/raw/main/config.json`
105
+ );
106
+ responseText = await modelInfoPromise.then(r => r.text());
107
+ config = JSON.parse(responseText);
108
  } catch (err) {
109
+ alert(sanitize(responseText))
110
  return config;
111
  }
112