MZhaovo commited on
Commit
2b28532
1 Parent(s): 8f472c2

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +7 -4
  2. css/style.css +39 -11
app.py CHANGED
@@ -96,8 +96,9 @@ def speak_fn(
96
 
97
 
98
  def init_fn():
99
- gr.Info("2023-11-24: 优化长句生成效果;更新了一些小彩蛋。")
100
- gr.Info("2023-11-23: Only support Chinese now. Trying to train a mutilingual model.")
 
101
 
102
 
103
  with open("./css/style.css", "r", encoding="utf-8") as f:
@@ -107,9 +108,11 @@ with gr.Blocks(css=customCSS) as demo:
107
  exceed_flag = gr.State(value=False)
108
  talkingFlowerPic = gr.HTML("""<img src="file=assets/flower-2x.webp" alt="TalkingFlowerPic">""", elem_id="talking_flower_pic")
109
  input_text = gr.Textbox(lines=1, label="Talking Flower will say:", elem_classes="wonder-card", elem_id="input_text")
110
- speak_button = gr.Button("Speak!", elem_id="comfirm_button", elem_classes="button wonder-card")
 
111
  audio_output = gr.Audio(label="输出音频", show_label=False, autoplay=True, elem_id="audio_output", elem_classes="wonder-card")
112
 
 
113
  demo.load(
114
  init_fn,
115
  inputs=[],
@@ -132,7 +135,7 @@ if __name__ == "__main__":
132
  version = hps.version if hasattr(hps, "version") else latest_version
133
  net_g = get_net_g(model_path=config.webui_config.model, version=version, device=device, hps=hps)
134
  reload_javascript()
135
- demo.queue().launch(
136
  allowed_paths=["./assets"],
137
  show_api=False,
138
  # server_name=server_name,
 
96
 
97
 
98
  def init_fn():
99
+ gr.Info("2023-11-23: 花钱买了稍微好一点的服务器,现在生成应该更快了。")
100
+ gr.Info("2023-11-24: 优化长句生成效果;增加示例;更新了一些小彩蛋。")
101
+ gr.Info("Only support Chinese now. Trying to train a mutilingual model.")
102
 
103
 
104
  with open("./css/style.css", "r", encoding="utf-8") as f:
 
108
  exceed_flag = gr.State(value=False)
109
  talkingFlowerPic = gr.HTML("""<img src="file=assets/flower-2x.webp" alt="TalkingFlowerPic">""", elem_id="talking_flower_pic")
110
  input_text = gr.Textbox(lines=1, label="Talking Flower will say:", elem_classes="wonder-card", elem_id="input_text")
111
+ speak_button = gr.Button("Speak!", elem_id="speak_button", elem_classes="button wonder-card")
112
+ gr.Examples(["你今天好棒", "雄蕊羊痒的", "我一朵花好害怕", "再来找我玩哦", "冲呀冲呀!", "塔塔开!一字摸塔塔开!", "好了是闺蜜,不好嘞是敌咪"], label=None, inputs=[input_text], elem_id="examples")
113
  audio_output = gr.Audio(label="输出音频", show_label=False, autoplay=True, elem_id="audio_output", elem_classes="wonder-card")
114
 
115
+
116
  demo.load(
117
  init_fn,
118
  inputs=[],
 
135
  version = hps.version if hasattr(hps, "version") else latest_version
136
  net_g = get_net_g(model_path=config.webui_config.model, version=version, device=device, hps=hps)
137
  reload_javascript()
138
+ demo.launch(
139
  allowed_paths=["./assets"],
140
  show_api=False,
141
  # server_name=server_name,
css/style.css CHANGED
@@ -65,6 +65,11 @@ gradio-app {
65
  margin-top: 4rem !important;
66
  }
67
 
 
 
 
 
 
68
  .wonder-card {
69
  --border-radius: 15px;
70
  --border-color: var(--color-accent-black);
@@ -93,13 +98,16 @@ gradio-app {
93
  transition-property: transform,box-shadow !important;
94
  }
95
 
 
 
 
 
96
  #input_text {
97
  display: flex;
98
  background: #ffffff !important;
99
  height: 12rem !important;
100
 
101
  }
102
-
103
  #input_text label {
104
  margin-top: -2.25rem !important;
105
  display: flex;
@@ -110,16 +118,12 @@ gradio-app {
110
  justify-content: center;
111
  align-items: center;
112
  }
113
-
114
  #input_text label span {
115
  font-family: var(--font-heading) !important;
116
  font-size: 1.225rem;
117
  }
118
 
119
- #input_text label textarea {
120
- width: 80%;
121
- }
122
-
123
  .button {
124
  font-size: 1.625rem !important;
125
  font-family: var(--font-heading) !important;
@@ -135,7 +139,6 @@ gradio-app {
135
  /* padding: 16px 28px !important; */
136
  z-index: 10 !important;
137
  }
138
-
139
  .button:hover {
140
  --shadow-y: 6px !important;
141
  --shadow-x: 4px !important;
@@ -153,16 +156,42 @@ gradio-app {
153
  justify-content: flex-end;
154
  }
155
 
156
- #talking_flower_pic img {
157
- height: 10rem;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
158
  }
159
 
 
160
  #audio_output {
161
  align-self: center !important;
162
  width: var(--card-width) !important;
163
  /* background: #4fd644 !important; */
164
  }
165
-
166
  #audio_output .icon-buttons {
167
  --border-radius: 15px;
168
  --border-color: var(
@@ -175,7 +204,6 @@ gradio-app {
175
  transition: transform calc(var(--duration-factor) * .1s) ease-in-out !important;
176
  transition-property: transform,box-shadow !important;
177
  }
178
-
179
  #audio_output .icon-buttons:hover {
180
  --shadow-y: 1.5px !important;
181
  --shadow-x: 1px !important;
 
65
  margin-top: 4rem !important;
66
  }
67
 
68
+ /* TalkingFlower Image */
69
+ #talking_flower_pic img {
70
+ height: 10rem;
71
+ }
72
+
73
  .wonder-card {
74
  --border-radius: 15px;
75
  --border-color: var(--color-accent-black);
 
98
  transition-property: transform,box-shadow !important;
99
  }
100
 
101
+ /* Input_text */
102
+ #input_text label textarea {
103
+ width: 80%;
104
+ }
105
  #input_text {
106
  display: flex;
107
  background: #ffffff !important;
108
  height: 12rem !important;
109
 
110
  }
 
111
  #input_text label {
112
  margin-top: -2.25rem !important;
113
  display: flex;
 
118
  justify-content: center;
119
  align-items: center;
120
  }
 
121
  #input_text label span {
122
  font-family: var(--font-heading) !important;
123
  font-size: 1.225rem;
124
  }
125
 
126
+ /* Main Button */
 
 
 
127
  .button {
128
  font-size: 1.625rem !important;
129
  font-family: var(--font-heading) !important;
 
139
  /* padding: 16px 28px !important; */
140
  z-index: 10 !important;
141
  }
 
142
  .button:hover {
143
  --shadow-y: 6px !important;
144
  --shadow-x: 4px !important;
 
156
  justify-content: flex-end;
157
  }
158
 
159
+ /* Examples */
160
+ #examples {
161
+ width: var(--card-width) !important;
162
+ align-self: center;
163
+ padding: 0.2rem;
164
+ }
165
+ #examples .label {
166
+ display: none !important;
167
+ }
168
+ #examples button {
169
+ --border-radius: 12px;
170
+ --border-color: var(--color-accent-black);
171
+
172
+ background: #b787d2;
173
+ color: #fefdff;
174
+ backface-visibility: hidden !important;
175
+ border: solid var(--border-width,2px) var(--border-color,var(--color-accent-black)) !important;
176
+ border-radius: var(--border-radius) !important;
177
+ box-shadow: var(--shadow-x,1px) var(--shadow-y,2px) 0 var(--shadow-size,1px) var(--border-color,var(--color-accent-black)) !important;
178
+ overflow: hidden !important;
179
+ transition: transform calc(var(--duration-factor) * .1s) ease-in-out !important;
180
+ transition-property: transform,box-shadow !important;
181
+ }
182
+ #examples button:hover {
183
+ --shadow-y: 3px !important;
184
+ --shadow-x: 2px !important;
185
+
186
+ transform: translate(-1px,-1px) !important;
187
  }
188
 
189
+ /* Audio_output */
190
  #audio_output {
191
  align-self: center !important;
192
  width: var(--card-width) !important;
193
  /* background: #4fd644 !important; */
194
  }
 
195
  #audio_output .icon-buttons {
196
  --border-radius: 15px;
197
  --border-color: var(
 
204
  transition: transform calc(var(--duration-factor) * .1s) ease-in-out !important;
205
  transition-property: transform,box-shadow !important;
206
  }
 
207
  #audio_output .icon-buttons:hover {
208
  --shadow-y: 1.5px !important;
209
  --shadow-x: 1px !important;