Upload index.html
Browse filesSanity check for the last sanity check
- index.html +15 -6
index.html
CHANGED
@@ -83,21 +83,30 @@
|
|
83 |
'>': '>',
|
84 |
'"': '"',
|
85 |
"'": ''',
|
86 |
-
"/": '
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
};
|
88 |
-
const reg = /[&<>"'
|
89 |
return string.replace(reg, (match) => (map[match]));
|
90 |
}
|
91 |
|
92 |
async function modelConfig(hf_model) {
|
93 |
-
let config = {}
|
|
|
94 |
|
95 |
try {
|
96 |
-
|
97 |
`https://huggingface.co/${hf_model}/raw/main/config.json`
|
98 |
-
)
|
|
|
|
|
99 |
} catch (err) {
|
100 |
-
alert(sanitize(
|
101 |
return config;
|
102 |
}
|
103 |
|
|
|
83 |
'>': '>',
|
84 |
'"': '"',
|
85 |
"'": ''',
|
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 |
|