Spaces:
Runtime error
Runtime error
Delete app.py
Browse files
app.py
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
import time
|
2 |
-
|
3 |
-
from theme_dropdown import create_theme_dropdown # noqa: F401
|
4 |
-
|
5 |
-
import gradio as gr
|
6 |
-
|
7 |
-
dropdown, js = create_theme_dropdown()
|
8 |
-
|
9 |
-
with gr.Blocks(theme='Arshj/gmjk_gradio') as demo:
|
10 |
-
with gr.Row().style(equal_height=True):
|
11 |
-
with gr.Column(scale=10):
|
12 |
-
gr.Markdown(
|
13 |
-
"""
|
14 |
-
# Theme preview: `gmjk_gradio`
|
15 |
-
To use this theme, set `theme='Arshj/gmjk_gradio'` in `gr.Blocks()` or `gr.Interface()`.
|
16 |
-
You can append an `@` and a semantic version expression, e.g. @>=1.0.0,<2.0.0 to pin to a given version
|
17 |
-
of this theme.
|
18 |
-
"""
|
19 |
-
)
|
20 |
-
with gr.Column(scale=3):
|
21 |
-
with gr.Box():
|
22 |
-
dropdown.render()
|
23 |
-
toggle_dark = gr.Button(value="Toggle Dark").style(full_width=True)
|
24 |
-
|
25 |
-
dropdown.change(None, dropdown, None, _js=js)
|
26 |
-
toggle_dark.click(
|
27 |
-
None,
|
28 |
-
_js="""
|
29 |
-
() => {
|
30 |
-
document.body.classList.toggle('dark');
|
31 |
-
document.querySelector('gradio-app').style.backgroundColor = 'var(--color-background-primary)'
|
32 |
-
}
|
33 |
-
""",
|
34 |
-
)
|
35 |
-
|
36 |
-
with gr.Row():
|
37 |
-
with gr.Column(scale=2):
|
38 |
-
chatbot = gr.Chatbot([("Hello", "Hi")], label="Chatbot")
|
39 |
-
chat_btn = gr.Button("Add messages")
|
40 |
-
|
41 |
-
|
42 |
-
def chat(history):
|
43 |
-
time.sleep(2)
|
44 |
-
yield [["How are you?", "I am good."]]
|
45 |
-
|
46 |
-
|
47 |
-
chat_btn.click(
|
48 |
-
lambda history: history
|
49 |
-
+ [["How are you?", "I am good."]]
|
50 |
-
+ (time.sleep(2) or []),
|
51 |
-
chatbot,
|
52 |
-
chatbot,
|
53 |
-
)
|
54 |
-
with gr.Column(scale=1):
|
55 |
-
with gr.Accordion("Advanced Settings"):
|
56 |
-
gr.Markdown("Hello")
|
57 |
-
gr.Number(label="Chatbot control 1")
|
58 |
-
gr.Number(label="Chatbot control 2")
|
59 |
-
gr.Number(label="Chatbot control 3")
|
60 |
-
|
61 |
-
if __name__ == "__main__":
|
62 |
-
demo.queue().launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|