Nông Văn Thắng commited on
Commit
4b7eff8
1 Parent(s): f718110
Files changed (2) hide show
  1. app.py +11 -3
  2. mikutheme.py +146 -0
app.py CHANGED
@@ -316,8 +316,14 @@ if __name__ == "__main__":
316
  REFERENCE_AUDIO = os.path.join(SCRIPT_DIR, "assets", "vixtts_sample_female.wav")
317
  if args.reference_audio:
318
  REFERENCE_AUDIO = os.abspath(args.reference_audio)
319
-
320
- with gr.Blocks() as demo:
 
 
 
 
 
 
321
  intro = """
322
  Ủng hộ chúng mình: Momo(0383253638)
323
  """
@@ -385,7 +391,7 @@ if __name__ == "__main__":
385
 
386
  tts_text = gr.Textbox(
387
  label="Văn bản chuyển đổi",
388
- value="Xin chào, mình là thắng",
389
  )
390
  tts_btn = gr.Button(value="Chuyển đổi", variant="primary")
391
 
@@ -414,3 +420,5 @@ if __name__ == "__main__":
414
  demo.launch()
415
 
416
 
 
 
 
316
  REFERENCE_AUDIO = os.path.join(SCRIPT_DIR, "assets", "vixtts_sample_female.wav")
317
  if args.reference_audio:
318
  REFERENCE_AUDIO = os.abspath(args.reference_audio)
319
+
320
+ with gr.Blocks(theme='NoCrypt/miku') as demo:
321
+ _js="""
322
+ () => {
323
+ document.body.classList.add('dark');
324
+ }
325
+ """
326
+ _js()
327
  intro = """
328
  Ủng hộ chúng mình: Momo(0383253638)
329
  """
 
391
 
392
  tts_text = gr.Textbox(
393
  label="Văn bản chuyển đổi",
394
+ value="xin chào, mình là công cụ chuyển đổi văn bản thành giọng nói",
395
  )
396
  tts_btn = gr.Button(value="Chuyển đổi", variant="primary")
397
 
 
420
  demo.launch()
421
 
422
 
423
+
424
+
mikutheme.py ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+
3
+ import gradio as gr
4
+ from gradio.themes.utils.theme_dropdown import create_theme_dropdown
5
+
6
+ dropdown, js = create_theme_dropdown()
7
+
8
+ with gr.Blocks(theme='NoCrypt/miku') as demo:
9
+ with gr.Row().style(equal_height=True):
10
+ with gr.Column(scale=10):
11
+ gr.Markdown(
12
+ """
13
+ # Theme preview: `miku`
14
+ To use this theme, set `theme='NoCrypt/miku'` in `gr.Blocks()` or `gr.Interface()`.
15
+ You can append an `@` and a semantic version expression, e.g. @>=1.0.0,<2.0.0 to pin to a given version
16
+ of this theme.
17
+ """
18
+ )
19
+ with gr.Column(scale=3):
20
+ with gr.Box():
21
+ dropdown.render()
22
+ toggle_dark = gr.Button(value="Toggle Dark").style(full_width=True)
23
+
24
+ dropdown.change(None, dropdown, None, _js=js)
25
+ toggle_dark.click(
26
+ None,
27
+ _js="""
28
+ () => {
29
+ document.body.classList.toggle('dark');
30
+ }
31
+ """,
32
+ )
33
+
34
+ name = gr.Textbox(
35
+ label="Name",
36
+ info="Full name, including middle name. No special characters.",
37
+ placeholder="John Doe",
38
+ value="John Doe",
39
+ interactive=True,
40
+ )
41
+
42
+ with gr.Row():
43
+ slider1 = gr.Slider(label="Slider 1")
44
+ slider2 = gr.Slider(label="Slider 2")
45
+ gr.CheckboxGroup(["A", "B", "C"], label="Checkbox Group")
46
+
47
+ with gr.Row():
48
+ with gr.Column(variant="panel", scale=1):
49
+ gr.Markdown("## Panel 1")
50
+ radio = gr.Radio(
51
+ ["A", "B", "C"],
52
+ label="Radio",
53
+ info="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.",
54
+ )
55
+ drop = gr.Dropdown(["Option 1", "Option 2", "Option 3"], show_label=False)
56
+ drop_2 = gr.Dropdown(
57
+ ["Option A", "Option B", "Option C"],
58
+ multiselect=True,
59
+ value=["Option A"],
60
+ label="Dropdown",
61
+ interactive=True,
62
+ )
63
+ check = gr.Checkbox(label="Go")
64
+ with gr.Column(variant="panel", scale=2):
65
+ img = gr.Image(
66
+ "https://i.ibb.co/F4hKFrZ/dark-miku.webp",
67
+ label="Image",
68
+ ).style(height=320)
69
+ with gr.Row():
70
+ go_btn = gr.Button("Go", label="Primary Button", variant="primary")
71
+ clear_btn = gr.Button(
72
+ "Clear", label="Secondary Button", variant="secondary"
73
+ )
74
+
75
+ def go(*args):
76
+ time.sleep(3)
77
+ return "https://i.ibb.co/0rfK9Wm/light-miku-faded.webp"
78
+
79
+ go_btn.click(go, [radio, drop, drop_2, check, name], img, api_name="go")
80
+
81
+ def clear():
82
+ time.sleep(0.2)
83
+ return None
84
+
85
+ clear_btn.click(clear, None, img)
86
+
87
+ with gr.Row():
88
+ btn1 = gr.Button("Button 1").style(size="sm")
89
+ btn2 = gr.UploadButton().style(size="sm")
90
+ stop_btn = gr.Button("Stop", label="Stop Button", variant="stop").style(
91
+ size="sm"
92
+ )
93
+
94
+ with gr.Row():
95
+ gr.Dataframe(value=[[1, 2, 3], [4, 5, 6], [7, 8, 9]], label="Dataframe")
96
+ gr.JSON(
97
+ value={"a": 1, "b": 2, "c": {"test": "a", "test2": [1, 2, 3]}}, label="JSON"
98
+ )
99
+ gr.Label(value={"cat": 0.7, "dog": 0.2, "fish": 0.1})
100
+ gr.File()
101
+ with gr.Row():
102
+ gr.ColorPicker()
103
+ gr.Video("https://gradio-static-files.s3.us-west-2.amazonaws.com/world.mp4")
104
+ gr.Gallery(
105
+ [
106
+ (
107
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/lion.jpg",
108
+ "lion",
109
+ ),
110
+ (
111
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/logo.png",
112
+ "logo",
113
+ ),
114
+ (
115
+ "https://gradio-static-files.s3.us-west-2.amazonaws.com/tower.jpg",
116
+ "tower",
117
+ ),
118
+ ]
119
+ ).style(height="200px", grid=2)
120
+
121
+ with gr.Row():
122
+ with gr.Column(scale=2):
123
+ chatbot = gr.Chatbot([("Hello", "Hi")], label="Chatbot")
124
+ chat_btn = gr.Button("Add messages")
125
+
126
+ def chat(history):
127
+ time.sleep(2)
128
+ yield [["How are you?", "I am good."]]
129
+
130
+ chat_btn.click(
131
+ lambda history: history
132
+ + [["How are you?", "I am good."]]
133
+ + (time.sleep(2) or []),
134
+ chatbot,
135
+ chatbot,
136
+ )
137
+ with gr.Column(scale=1):
138
+ with gr.Accordion("Advanced Settings"):
139
+ gr.Markdown("Hello")
140
+ gr.Number(label="Chatbot control 1")
141
+ gr.Number(label="Chatbot control 2")
142
+ gr.Number(label="Chatbot control 3")
143
+
144
+
145
+ if __name__ == "__main__":
146
+ demo.queue().launch()