Update app.py
Browse files
app.py
CHANGED
@@ -19,29 +19,14 @@ demo = gr.Interface(
|
|
19 |
fn=CustomChatGPT,
|
20 |
inputs=gr.Textbox(label="Insert jargon here (ask a question):", placeholder="E.g. What are gas fees?"),
|
21 |
outputs=gr.Textbox(label="Get a simple answer in return:"),
|
22 |
-
title="Web(GPT)3"
|
23 |
-
function handle_lightmode() {
|
24 |
-
let url = new URL(window.location.toString());
|
25 |
-
|
26 |
-
|
27 |
-
const color_mode: "light" | "dark" | "system" | null = url.searchParams.get(
|
28 |
-
"__theme"
|
29 |
-
) as "light" | "dark" | "system" | null;
|
30 |
-
|
31 |
-
|
32 |
-
if (color_mode !== null) {
|
33 |
-
if (color_mode === "light") {
|
34 |
-
lightmode();
|
35 |
-
} else if (color_mode === "system") {
|
36 |
-
use_system_theme();
|
37 |
-
}
|
38 |
-
// light is default, so we don't need to do anything else
|
39 |
-
} else if (url.searchParams.get("__light-theme") === "true") {
|
40 |
-
lightmode();
|
41 |
-
} else {
|
42 |
-
use_system_theme();
|
43 |
-
}
|
44 |
-
}
|
45 |
)
|
46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
demo.launch()
|
|
|
19 |
fn=CustomChatGPT,
|
20 |
inputs=gr.Textbox(label="Insert jargon here (ask a question):", placeholder="E.g. What are gas fees?"),
|
21 |
outputs=gr.Textbox(label="Get a simple answer in return:"),
|
22 |
+
title="Web(GPT)3"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
)
|
24 |
|
25 |
+
window.addEventListener('load', function () {
|
26 |
+
gradioURL = window.location.href
|
27 |
+
if (!gradioURL.endsWith('?__theme=light')) {
|
28 |
+
window.location.replace(gradioURL + '?__theme=light');
|
29 |
+
}
|
30 |
+
});
|
31 |
+
|
32 |
demo.launch()
|