ngocminhta commited on
Commit
65bfa7f
·
verified ·
1 Parent(s): 053c981

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -1
app.py CHANGED
@@ -50,8 +50,52 @@ def process_result_detection_tab(text, language):
50
  def clear_detection_tab():
51
  return "", gr.update(interactive=False)
52
 
53
- with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
  gr.Markdown("""<h1><center>AuthScan</center></h1>""")
 
 
 
 
55
  with gr.Tab("Code Detection"):
56
  with gr.Row():
57
  language = gr.Dropdown(
 
50
  def clear_detection_tab():
51
  return "", gr.update(interactive=False)
52
 
53
+ css = """
54
+ body.dark-mode {
55
+ background-color: #2c2c2c;
56
+ color: white;
57
+ }
58
+ body.light-mode {
59
+ background-color: white;
60
+ color: black;
61
+ }
62
+ #dark-mode-toggle {
63
+ position: fixed;
64
+ top: 10px;
65
+ right: 10px;
66
+ z-index: 1000;
67
+ padding: 10px 15px;
68
+ background-color: #007bff;
69
+ color: white;
70
+ border: none;
71
+ border-radius: 5px;
72
+ cursor: pointer;
73
+ font-size: 14px;
74
+ }
75
+ #dark-mode-toggle:hover {
76
+ background-color: #0056b3;
77
+ }
78
+ """
79
+
80
+ js = """
81
+ function toggleDarkMode() {
82
+ const body = document.body;
83
+ if (body.classList.contains('dark-mode')) {
84
+ body.classList.remove('dark-mode');
85
+ body.classList.add('light-mode');
86
+ } else {
87
+ body.classList.remove('light-mode');
88
+ body.classList.add('dark-mode');
89
+ }
90
+ }
91
+ """
92
+
93
+ with gr.Blocks(theme=gr.themes.Soft()) as demo:
94
  gr.Markdown("""<h1><center>AuthScan</center></h1>""")
95
+ gr.HTML("<script>{}</script>".format(js))
96
+ gr.HTML(
97
+ '<button id="dark-mode-toggle" onclick="toggleDarkMode()">Switch</button>'
98
+ )
99
  with gr.Tab("Code Detection"):
100
  with gr.Row():
101
  language = gr.Dropdown(