MZhaovo commited on
Commit
007b414
1 Parent(s): 2b28532

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. app.py +15 -8
  2. css/style.css +101 -17
app.py CHANGED
@@ -96,8 +96,8 @@ def speak_fn(
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
 
@@ -107,9 +107,16 @@ with open("./css/style.css", "r", encoding="utf-8") as f:
107
  with gr.Blocks(css=customCSS) as demo:
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
 
@@ -118,14 +125,14 @@ with gr.Blocks(css=customCSS) as demo:
118
  inputs=[],
119
  outputs=[]
120
  )
121
- input_text.submit(
122
  speak_fn,
123
- inputs=[input_text, exceed_flag],
124
  outputs=[audio_output, exceed_flag],
125
  )
126
  speak_button.click(
127
  speak_fn,
128
- inputs=[input_text, exceed_flag],
129
  outputs=[audio_output, exceed_flag],
130
  )
131
 
 
96
 
97
 
98
  def init_fn():
99
+ gr.Info("2023-11-23: 有什么建议可以在 Community 中提哦。")
100
+ gr.Info("2023-11-24: 优化长句生成效果;增加示例;更新了一些小彩蛋;画了一些大饼)")
101
  gr.Info("Only support Chinese now. Trying to train a mutilingual model.")
102
 
103
 
 
107
  with gr.Blocks(css=customCSS) as demo:
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
+ with gr.Tab("Speak", elem_id="tab-speak"):
111
+ speak_input = gr.Textbox(lines=1, label="Talking Flower will say:", elem_classes="wonder-card", elem_id="input_text")
112
+ speak_button = gr.Button("Speak!", elem_id="speak_button", elem_classes="main-button wonder-card")
113
+ gr.Examples(["你今天好棒!", "雄蕊羊痒的~", "我一朵花好害怕", "再来找我玩哦", "冲呀冲呀!", "塔塔开!一字摸塔塔开!", "好了是闺蜜,不好嘞是敌咪"], label=None, inputs=[speak_input], elem_id="examples")
114
+ with gr.Tab("Chat", elem_id="tab-chat"):
115
+ chat_input = gr.Textbox(lines=1, placeholder="Coming Soon...", label="Chat to Talking Flower:", elem_classes="wonder-card", elem_id="input_text", interactive=False)
116
+ chat_button = gr.Button("Chat!", elem_id="chat_button", elem_classes="main-button wonder-card")
117
+ with gr.Tab("Mimic", elem_id="tab-mimic"):
118
+ gr.Textbox(lines=1, placeholder="Coming Soon...", label="Choose sound to mimic:", elem_classes="wonder-card", elem_id="input_text", interactive=False)
119
+ mimic_button = gr.Button("Mimic!", elem_id="mimic_button", elem_classes="main-button wonder-card")
120
  audio_output = gr.Audio(label="输出音频", show_label=False, autoplay=True, elem_id="audio_output", elem_classes="wonder-card")
121
 
122
 
 
125
  inputs=[],
126
  outputs=[]
127
  )
128
+ speak_input.submit(
129
  speak_fn,
130
+ inputs=[speak_input, exceed_flag],
131
  outputs=[audio_output, exceed_flag],
132
  )
133
  speak_button.click(
134
  speak_fn,
135
+ inputs=[speak_input, exceed_flag],
136
  outputs=[audio_output, exceed_flag],
137
  )
138
 
css/style.css CHANGED
@@ -53,6 +53,8 @@
53
  -moz-text-size-adjust: none;
54
  text-size-adjust: none
55
  }
 
 
56
 
57
  gradio-app {
58
  background: url("file=assets/hero-header-layer-1-large-up-2x.jpg") no-repeat !important;
@@ -70,6 +72,73 @@ gradio-app {
70
  height: 10rem;
71
  }
72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  .wonder-card {
74
  --border-radius: 15px;
75
  --border-color: var(--color-accent-black);
@@ -83,11 +152,11 @@ gradio-app {
83
  transition-property: transform,box-shadow !important;
84
  }
85
 
 
86
  .form {
87
  --border-radius: 15px;
88
  --border-color: var(--color-accent-black);
89
 
90
- width: var(--card-width) !important;
91
  align-self: center !important;
92
  backface-visibility: hidden !important;
93
  border: solid var(--border-width,4px) var(--border-color,var(--color-accent-black)) !important;
@@ -98,7 +167,6 @@ gradio-app {
98
  transition-property: transform,box-shadow !important;
99
  }
100
 
101
- /* Input_text */
102
  #input_text label textarea {
103
  width: 80%;
104
  }
@@ -124,47 +192,63 @@ gradio-app {
124
  }
125
 
126
  /* Main Button */
127
- .button {
128
  font-size: 1.625rem !important;
129
  font-family: var(--font-heading) !important;
130
  font-style: normal !important;
131
  font-weight: 900 !important;
132
- color: var(--color-accent-black) !important;
133
 
134
- background: var(--color-yellow) !important;
135
  margin-top: -36px !important;
136
  width: fit-content !important;
137
  height: fit-content !important;
138
  align-self: center !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;
145
 
146
- background: #f5a200 !important;
147
  transform: translate(-2px,-2px) !important;
148
  }
149
-
150
- #talking_flower_pic {
151
- display: flex;
152
- align-self: center !important;
153
- width: var(--card-width) !important;
154
- object-fit: cover !important;
155
- object-position: center !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);
 
53
  -moz-text-size-adjust: none;
54
  text-size-adjust: none
55
  }
56
+ /* ------------ DEFINE END ------------ */
57
+
58
 
59
  gradio-app {
60
  background: url("file=assets/hero-header-layer-1-large-up-2x.jpg") no-repeat !important;
 
72
  height: 10rem;
73
  }
74
 
75
+ /* Tabs */
76
+ .tabs {
77
+ width: var(--card-width) !important;
78
+ align-self: center;
79
+ }
80
+ .tabs .tab-nav {
81
+ font-family: var(--font-heading);
82
+ display: flex;
83
+ position: relative;
84
+ flex-wrap: wrap;
85
+ border-bottom: 0px !important;
86
+ margin-bottom: -1.5rem;
87
+ z-index: 100;
88
+ }
89
+ .tabs .tab-nav button {
90
+ --border-color: var(--color-accent-black);
91
+ font-size: 1.1rem !important;
92
+
93
+ background: #b787d2;
94
+ color: #fefdff;
95
+ backface-visibility: hidden !important;
96
+ border: solid var(--border-width,3px) var(--border-color,var(--color-accent-black)) !important;
97
+ border-radius: 1rem 0.1rem !important;
98
+ /* box-shadow: var(--shadow-x,1px) var(--shadow-y,2px) 0 var(--shadow-size,1px) var(--border-color,var(--color-accent-black)) !important; */
99
+ overflow: hidden !important;
100
+ transition: transform calc(var(--duration-factor) * .1s) ease-in-out !important;
101
+ transition-property: transform,box-shadow !important;
102
+ margin-right: 0.75rem;
103
+ }
104
+ .tabs .tab-nav button:hover {
105
+ --shadow-y: 3px !important;
106
+ --shadow-x: 2px !important;
107
+ transform: translate(-1px,-1px) !important;
108
+ }
109
+ .tabs .tabitem {
110
+ border: 0px !important;
111
+ }
112
+ .tabs .selected {
113
+ --shadow-y: 3px !important;
114
+ --shadow-x: 2px !important;
115
+ box-shadow: var(--shadow-x,1px) var(--shadow-y,2px) 0 var(--shadow-size,1px) var(--border-color,var(--color-accent-black)) !important;
116
+ transform: translate(-1px,-1px) !important;
117
+ }
118
+ #tab-speak-button {
119
+ background: var(--color-yellow);
120
+ color: var(--color-accent-black);
121
+ }
122
+ #tab-chat-button {
123
+ background: #2263c6;
124
+ color: var(--color-white);
125
+ }
126
+ #tab-mimic-button {
127
+ background: #fc3e9d;
128
+ color: var(--color-white);
129
+ }
130
+
131
+
132
+ /* TalkingFlower Portrait */
133
+ #talking_flower_pic {
134
+ display: flex;
135
+ align-self: center !important;
136
+ width: var(--card-width) !important;
137
+ object-fit: cover !important;
138
+ object-position: center !important;
139
+ justify-content: flex-end;
140
+ }
141
+
142
  .wonder-card {
143
  --border-radius: 15px;
144
  --border-color: var(--color-accent-black);
 
152
  transition-property: transform,box-shadow !important;
153
  }
154
 
155
+ /* Input_text */
156
  .form {
157
  --border-radius: 15px;
158
  --border-color: var(--color-accent-black);
159
 
 
160
  align-self: center !important;
161
  backface-visibility: hidden !important;
162
  border: solid var(--border-width,4px) var(--border-color,var(--color-accent-black)) !important;
 
167
  transition-property: transform,box-shadow !important;
168
  }
169
 
 
170
  #input_text label textarea {
171
  width: 80%;
172
  }
 
192
  }
193
 
194
  /* Main Button */
195
+ .main-button {
196
  font-size: 1.625rem !important;
197
  font-family: var(--font-heading) !important;
198
  font-style: normal !important;
199
  font-weight: 900 !important;
 
200
 
 
201
  margin-top: -36px !important;
202
  width: fit-content !important;
203
  height: fit-content !important;
204
  align-self: center !important;
 
205
  z-index: 10 !important;
206
  }
207
+ .main-button:hover {
208
  --shadow-y: 6px !important;
209
  --shadow-x: 4px !important;
210
 
 
211
  transform: translate(-2px,-2px) !important;
212
  }
213
+ #speak_button {
214
+ background: var(--color-yellow) !important;
215
+ color: var(--color-accent-black) !important;
216
+ }
217
+ #speak_button:hover {
218
+ background: #f5a200 !important;
219
+ }
220
+ #chat_button {
221
+ background: #2263c6 !important;
222
+ color: var(--color-white) !important;
223
+ }
224
+ #chat_button:hover {
225
+ background: #124080 !important;
226
+ }
227
+ #mimic_button {
228
+ background: #fc3e9d !important;
229
+ color: var(--color-white) !important;
230
+ }
231
+ #mimic_button:hover {
232
+ background: #aa2567 !important;
233
  }
234
 
235
  /* Examples */
236
  #examples {
 
237
  align-self: center;
238
  padding: 0.2rem;
239
  }
240
  #examples .label {
241
  display: none !important;
242
  }
243
+ #examples .gallery {
244
+ display: flex;
245
+ flex-wrap: wrap;
246
+ gap: var(--spacing-lg);
247
+ justify-content: center;
248
+ align-items: center;
249
+ flex-direction: row;
250
+ align-content: center;
251
+ }
252
  #examples button {
253
  --border-radius: 12px;
254
  --border-color: var(--color-accent-black);