Web3Daily commited on
Commit
82e448f
1 Parent(s): a2033ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -19,8 +19,30 @@ 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
- theme="light !important;"
24
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  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
+ function handle_darkmode() {
26
+ let url = new URL(window.location.toString());
27
+
28
+
29
+ const color_mode: "light" | "dark" | "system" | null = url.searchParams.get(
30
+ "__theme"
31
+ ) as "light" | "dark" | "system" | null;
32
+
33
+
34
+ if (color_mode !== null) {
35
+ if (color_mode === "light") {
36
+ darkmode();
37
+ } else if (color_mode === "system") {
38
+ use_system_theme();
39
+ }
40
+ // light is default, so we don't need to do anything else
41
+ } else if (url.searchParams.get("__light-theme") === "true") {
42
+ darkmode();
43
+ } else {
44
+ use_system_theme();
45
+ }
46
+ }
47
 
48
  demo.launch()