Dagfinn1962 commited on
Commit
df6ace3
1 Parent(s): f8e753c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -15
app.py CHANGED
@@ -7,6 +7,35 @@ import base64
7
  import os
8
  from PIL import Image
9
  from io import BytesIO
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
  class Prodia:
12
  def __init__(self, api_key, base=None):
@@ -100,22 +129,8 @@ css = """
100
  }
101
  """
102
 
103
- with gr.Blocks(theme='xiaobaiyuan/theme_demo') as demo:
104
-
105
- with gr.Column(scale=3):
106
- with gr.Box():
107
- dropdown.render()
108
- toggle_dark = gr.Button(value="Toggle Dark").style(full_width=True)
109
 
110
- dropdown.change(None, dropdown, None, _js=js)
111
- toggle_dark.click(
112
- None,
113
- _js="""
114
- () => {
115
- document.body.classList.toggle('dark');
116
- }
117
- """,
118
- )
119
 
120
  with gr.Row():
121
  with gr.Column(scale=6):
 
7
  import os
8
  from PIL import Image
9
  from io import BytesIO
10
+ from gradio.themes.utils.theme_dropdown import create_theme_dropdown
11
+
12
+ dropdown, js = create_theme_dropdown()
13
+
14
+ with gr.Blocks(theme='xiaobaiyuan/theme_demo') as demo:
15
+ with gr.Row().style(equal_height=True):
16
+ with gr.Column(scale=10):
17
+ gr.Markdown(
18
+ """
19
+ # Theme preview: `theme_demo`
20
+ To use this theme, set `theme='xiaobaiyuan/theme_demo'` in `gr.Blocks()` or `gr.Interface()`.
21
+ You can append an `@` and a semantic version expression, e.g. @>=1.0.0,<2.0.0 to pin to a given version
22
+ of this theme.
23
+ """
24
+ )
25
+ with gr.Column(scale=3):
26
+ with gr.Box():
27
+ dropdown.render()
28
+ toggle_dark = gr.Button(value="Toggle Dark").style(full_width=True)
29
+
30
+ dropdown.change(None, dropdown, None, _js=js)
31
+ toggle_dark.click(
32
+ None,
33
+ _js="""
34
+ () => {
35
+ document.body.classList.toggle('dark');
36
+ }
37
+ """,
38
+ )
39
 
40
  class Prodia:
41
  def __init__(self, api_key, base=None):
 
129
  }
130
  """
131
 
132
+ with gr.Blocks(CSS=CSS) as demo:
 
 
 
 
 
133
 
 
 
 
 
 
 
 
 
 
134
 
135
  with gr.Row():
136
  with gr.Column(scale=6):