형규 송 commited on
Commit
5e12b9f
1 Parent(s): ebc3deb

remove padding options unused, fix description

Browse files

(0aa77a0 in https://bitbucket.org/maum-system/cvpr22-demo-gradio)

Files changed (2) hide show
  1. app.py +4 -15
  2. client_rest.py +3 -3
app.py CHANGED
@@ -119,7 +119,7 @@ class GradioApplication:
119
 
120
  return background_data, is_video_background
121
 
122
- def infer(self, text, lang, duration_rate, pad_begin, pad_end, action, background_index):
123
  self._counter_file_seed()
124
  print(f"File Seed: {self._file_seed}")
125
  target_text, lang_dest = self.translator.get_translation(text, lang)
@@ -127,7 +127,7 @@ class GradioApplication:
127
 
128
  background_data, is_video_background = self.get_background_data(background_index)
129
 
130
- video_data = self.rest_application.get_video(target_text, lang_rpc_code, duration_rate, pad_begin, pad_end, action.lower(),
131
  background_data, is_video_background)
132
  print(len(video_data))
133
 
@@ -161,17 +161,7 @@ def prepare_input():
161
  maximum=1.2,
162
  step=0.01,
163
  value=1.0,
164
- label="Duration (The bigger the value, the slower it pronounces)")
165
- start_padding_input = gr.Slider(minimum=0.0,
166
- maximum=2.0,
167
- step=0.1,
168
- value=0.0,
169
- label="Start padding (s)")
170
- end_padding_input = gr.Slider(minimum=0.0,
171
- maximum=2.0,
172
- step=0.1,
173
- value=0.0,
174
- label="End padding (s)")
175
  action_input = gr.Radio(['Default', 'Hand', 'BothHand', 'HandDown', 'Sorry'],
176
  type='value',
177
  value='Default',
@@ -181,8 +171,7 @@ def prepare_input():
181
  value='None',
182
  label="Select a background image/video ...")
183
 
184
- return [text_input, lang_input,
185
- duration_rate_input, start_padding_input, end_padding_input,
186
  action_input, background_input]
187
 
188
 
119
 
120
  return background_data, is_video_background
121
 
122
+ def infer(self, text, lang, duration_rate, action, background_index):
123
  self._counter_file_seed()
124
  print(f"File Seed: {self._file_seed}")
125
  target_text, lang_dest = self.translator.get_translation(text, lang)
127
 
128
  background_data, is_video_background = self.get_background_data(background_index)
129
 
130
+ video_data = self.rest_application.get_video(target_text, lang_rpc_code, duration_rate, action.lower(),
131
  background_data, is_video_background)
132
  print(len(video_data))
133
 
161
  maximum=1.2,
162
  step=0.01,
163
  value=1.0,
164
+ label="Duration (The bigger the value, the slower the speech)")
 
 
 
 
 
 
 
 
 
 
165
  action_input = gr.Radio(['Default', 'Hand', 'BothHand', 'HandDown', 'Sorry'],
166
  type='value',
167
  value='Default',
171
  value='None',
172
  label="Select a background image/video ...")
173
 
174
+ return [text_input, lang_input, duration_rate_input,
 
175
  action_input, background_input]
176
 
177
 
client_rest.py CHANGED
@@ -20,7 +20,7 @@ class RestAPIApplication:
20
  self.generate_addr = (lambda id_: f'http://{ip}:{port}/generate/{id_}')
21
 
22
  @staticmethod
23
- def _get_json_request(text, lang, duration_rate, pad_begin, pad_end, action, background_data=None, is_video_background=False):
24
  request_form = dict()
25
 
26
  request_form['text'] = text
@@ -47,8 +47,8 @@ class RestAPIApplication:
47
  def _get_video_id(results):
48
  return json.loads(bytes.decode(results.content))['id']
49
 
50
- def get_video(self, text, lang, duration_rate, pad_begin, pad_end, action, background_data=None, is_video_background=False):
51
- request_json = self._get_json_request(text, lang, duration_rate, pad_begin, pad_end, action, background_data, is_video_background)
52
 
53
  # POST request with jsonified request
54
  results = requests.post(self.post_request_addr, headers=self.post_headers, data=request_json)
20
  self.generate_addr = (lambda id_: f'http://{ip}:{port}/generate/{id_}')
21
 
22
  @staticmethod
23
+ def _get_json_request(text, lang, duration_rate, action, background_data=None, is_video_background=False):
24
  request_form = dict()
25
 
26
  request_form['text'] = text
47
  def _get_video_id(results):
48
  return json.loads(bytes.decode(results.content))['id']
49
 
50
+ def get_video(self, text, lang, duration_rate, action, background_data=None, is_video_background=False):
51
+ request_json = self._get_json_request(text, lang, duration_rate, action, background_data, is_video_background)
52
 
53
  # POST request with jsonified request
54
  results = requests.post(self.post_request_addr, headers=self.post_headers, data=request_json)