Liusuthu commited on
Commit
63231e5
ยท
verified ยท
1 Parent(s): 279d146

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +73 -73
app.py CHANGED
@@ -130,79 +130,79 @@ def clear_video():
130
  gr.Textbox("")
131
  )
132
  ##################################่ฎพ็ฝฎๅ„่‡ช็š„app็ฑป####################
133
- # with gr.Blocks(css="app.css") as video:
134
- # with gr.Tab("Dynamic App"):
135
- # gr.Markdown(value=DESCRIPTION_DYNAMIC)
136
- # with gr.Row():
137
- # with gr.Column(scale=2):
138
- # input_video = gr.Video(
139
- # sources=["webcam", "upload"], elem_classes="video1", format='mp4'
140
- # )
141
- # with gr.Row():
142
- # clear_btn_dynamic = gr.Button(
143
- # value="Clear", interactive=True, scale=1
144
- # )
145
- # # submit_dynamic = gr.Button(
146
- # # value="Submit", interactive=True, scale=1, elem_classes="submit"
147
- # # )
148
- # submit_and_rank = gr.Button(
149
- # value="Score", interactive=True, scale=1, elem_classes="submit"
150
- # )
151
- # with gr.Column(scale=2, elem_classes="dl4"):
152
- # with gr.Row():
153
- # output_score = gr.Textbox(label="scores")
154
- # output_statistics = gr.Plot(
155
- # label="Statistics of emotions", elem_classes="stat"
156
- # )
157
- # output_audio=gr.Audio(interactive=False)
158
- # audio_test_button=gr.Button("ๅˆ†ๆž่ฏญ้Ÿณ")
159
- # out1=gr.Textbox(label="่ฏญ้Ÿณๅˆ†ๆž็ป“ๆžœ")
160
- # out2=gr.Textbox(label="้Ÿณ้ข‘ๆƒ…ๆ„Ÿ่ฏ†ๅˆซ1")
161
- # out3=gr.Textbox(label="้Ÿณ้ข‘ๆƒ…ๆ„Ÿ่ฏ†ๅˆซ2")
162
- # text_test_button=gr.Button("ๅˆ†ๆžๆ–‡ๆœฌ")
163
- # text_result=gr.Textbox(interactive=False)
164
- # gr.Examples(
165
- # [
166
- # "videos/video1.mp4",
167
- # "videos/video2.mp4",
168
- # "videos/sample.webm",
169
- # "videos/cnm.mp4",
170
- # ],
171
- # [input_video],
172
- # )
173
 
174
- # with gr.Tab("Authors"):
175
- # gr.Markdown(value=AUTHORS)
176
 
177
- # clear_btn_dynamic.click(
178
- # fn=clear_dynamic_info,
179
- # inputs=[],
180
- # outputs=[
181
- # input_video,
182
- # output_statistics,
183
- # output_score,
184
- # ],
185
- # queue=True,
186
- # )
187
- # submit_and_rank.click(
188
- # fn=preprocess_video_and_rank,
189
- # inputs=input_video,
190
- # outputs=[
191
- # output_statistics,
192
- # output_score,
193
- # output_audio,
194
- # ],
195
- # )
196
- # audio_test_button.click(
197
- # fn=classify_continuous,
198
- # inputs=output_audio,
199
- # outputs=[out1,out2,out3]
200
- # )
201
- # text_test_button.click(
202
- # fn=text_api,
203
- # inputs=out1,
204
- # outputs=text_result,
205
- # )
206
 
207
  ####################################
208
  speech = gr.Interface(
@@ -307,8 +307,8 @@ with gr.Blocks() as text_all:
307
  with gr.Blocks() as app:
308
  with gr.Tab("่ฏญ้Ÿณ"):
309
  speech.render()
310
- # with gr.Tab("่ง†้ข‘"):
311
- # video.render()
312
  with gr.Tab("่ง†้ข‘้›†ๆˆๆ‰“ๅˆ†"):
313
  video_all.render()
314
  with gr.Tab("่ฏญ้Ÿณ้›†ๆˆๆ‰“ๅˆ†"):
 
130
  gr.Textbox("")
131
  )
132
  ##################################่ฎพ็ฝฎๅ„่‡ช็š„app็ฑป####################
133
+ with gr.Blocks(css="app.css") as video:
134
+ with gr.Tab("Dynamic App"):
135
+ gr.Markdown(value=DESCRIPTION_DYNAMIC)
136
+ with gr.Row():
137
+ with gr.Column(scale=2):
138
+ input_video = gr.Video(
139
+ sources=["webcam", "upload"], elem_classes="video1", format='mp4'
140
+ )
141
+ with gr.Row():
142
+ clear_btn_dynamic = gr.Button(
143
+ value="Clear", interactive=True, scale=1
144
+ )
145
+ # submit_dynamic = gr.Button(
146
+ # value="Submit", interactive=True, scale=1, elem_classes="submit"
147
+ # )
148
+ submit_and_rank = gr.Button(
149
+ value="Score", interactive=True, scale=1, elem_classes="submit"
150
+ )
151
+ with gr.Column(scale=2, elem_classes="dl4"):
152
+ with gr.Row():
153
+ output_score = gr.Textbox(label="scores")
154
+ output_statistics = gr.Plot(
155
+ label="Statistics of emotions", elem_classes="stat"
156
+ )
157
+ output_audio=gr.Audio(interactive=False)
158
+ audio_test_button=gr.Button("ๅˆ†ๆž่ฏญ้Ÿณ")
159
+ out1=gr.Textbox(label="่ฏญ้Ÿณๅˆ†ๆž็ป“ๆžœ")
160
+ out2=gr.Textbox(label="้Ÿณ้ข‘ๆƒ…ๆ„Ÿ่ฏ†ๅˆซ1")
161
+ out3=gr.Textbox(label="้Ÿณ้ข‘ๆƒ…ๆ„Ÿ่ฏ†ๅˆซ2")
162
+ text_test_button=gr.Button("ๅˆ†ๆžๆ–‡ๆœฌ")
163
+ text_result=gr.Textbox(interactive=False)
164
+ gr.Examples(
165
+ [
166
+ "videos/video1.mp4",
167
+ "videos/video2.mp4",
168
+ "videos/sample.webm",
169
+ "videos/cnm.mp4",
170
+ ],
171
+ [input_video],
172
+ )
173
 
174
+ with gr.Tab("Authors"):
175
+ gr.Markdown(value=AUTHORS)
176
 
177
+ clear_btn_dynamic.click(
178
+ fn=clear_dynamic_info,
179
+ inputs=[],
180
+ outputs=[
181
+ input_video,
182
+ output_statistics,
183
+ output_score,
184
+ ],
185
+ queue=True,
186
+ )
187
+ submit_and_rank.click(
188
+ fn=preprocess_video_and_rank,
189
+ inputs=input_video,
190
+ outputs=[
191
+ output_statistics,
192
+ output_score,
193
+ output_audio,
194
+ ],
195
+ )
196
+ audio_test_button.click(
197
+ fn=classify_continuous,
198
+ inputs=output_audio,
199
+ outputs=[out1,out2,out3]
200
+ )
201
+ text_test_button.click(
202
+ fn=text_api,
203
+ inputs=out1,
204
+ outputs=text_result,
205
+ )
206
 
207
  ####################################
208
  speech = gr.Interface(
 
307
  with gr.Blocks() as app:
308
  with gr.Tab("่ฏญ้Ÿณ"):
309
  speech.render()
310
+ with gr.Tab("่ง†้ข‘"):
311
+ video.render()
312
  with gr.Tab("่ง†้ข‘้›†ๆˆๆ‰“ๅˆ†"):
313
  video_all.render()
314
  with gr.Tab("่ฏญ้Ÿณ้›†ๆˆๆ‰“ๅˆ†"):