mdsr commited on
Commit
50f0067
·
1 Parent(s): a57329a

english examples, move hands to pose wrist, Note

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +17 -8
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: 🏆
4
  colorFrom: green
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 4.44.0
8
  app_file: app.py
9
  pinned: false
10
  license: cc-by-4.0
 
4
  colorFrom: green
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 4.*
8
  app_file: app.py
9
  pinned: false
10
  license: cc-by-4.0
app.py CHANGED
@@ -10,9 +10,11 @@ DESCRIPTION = """Enter your text and select languages from the dropdowns, then c
10
 
11
  The text is preprocessed, tokenized and rearranged and then each token is mapped to a prerecorded video which are concatenated and returned. [`Model Code`](https://github.com/sign-language-translator/sign-language-translator/blob/main/sign_language_translator/models/text_to_sign/concatenative_synthesis.py)
12
 
13
- > *NOTE*: This model only supports a fixed vocabulary. See the [`*-dictionary-mapping.json`](https://github.com/sign-language-translator/sign-language-datasets/tree/main/parallel_texts) files for supported words.
14
- > This version needs to re-encode the generated video so that will take some extra time after translation.
15
- > Since this is a rule-based model, you will have to add **context** to ambiguous words (e.g. glass(material) vs glass(container)).
 
 
16
  """.strip()
17
 
18
  TITLE = "Concatenative Synthesis: Rule Based Text to Sign Language Translator"
@@ -275,9 +277,14 @@ def text_to_video(
275
 
276
  sign = translation_model.translate(text)
277
  if isinstance(sign, slt.Landmarks):
278
- sign.data[:, 33:] *= 2
279
- sign.data[:, 33:54, 0] += 0.25
280
- sign.data[:, 54:, 0] -= 0.25
 
 
 
 
 
281
 
282
  sign.save_animation(output_path, overwrite=True)
283
  else:
@@ -407,10 +414,12 @@ with gradio.Blocks(title=TITLE, head=CUSTOM_JS, css=CUSTOM_CSS) as gradio_app:
407
 
408
  gradio.Examples(
409
  [
 
 
410
  ["یہ بہت اچھا ہے۔", "urdu", "pakistan-sign-language", "video"],
411
  ["وہ کام آسان تھا۔", "urdu", "pakistan-sign-language", "landmarks"],
412
- ["पाँच घंटे।", "hindi", "pakistan-sign-language", "video"],
413
- ["कैसे हैं आप?", "hindi", "pakistan-sign-language", "landmarks"],
414
  ],
415
  inputs=[
416
  source_textbox,
 
10
 
11
  The text is preprocessed, tokenized and rearranged and then each token is mapped to a prerecorded video which are concatenated and returned. [`Model Code`](https://github.com/sign-language-translator/sign-language-translator/blob/main/sign_language_translator/models/text_to_sign/concatenative_synthesis.py)
12
 
13
+ > **NOTE**
14
+ > - This model only supports a fixed vocabulary. See the [`*-dictionary-mapping.json`](https://github.com/sign-language-translator/sign-language-datasets/tree/main/parallel_texts) files for supported words.
15
+ > - This version needs to re-encode the generated video so that will take some extra time after translation.
16
+ > - Since this is a rule-based model, you will have to add **context** to ambiguous words (e.g. glass(material) vs glass(container)).
17
+ > - Some signs correspond to words very specific in a particular language so their mapping in other languages will not make sense (e.g. in pakistan-sign-language, signs were recorded in reference to common Urdu words, hence English words "for" & "to" etc do not map well to their original Urdu words "کے لئے" and "کو" etc).
18
  """.strip()
19
 
20
  TITLE = "Concatenative Synthesis: Rule Based Text to Sign Language Translator"
 
277
 
278
  sign = translation_model.translate(text)
279
  if isinstance(sign, slt.Landmarks):
280
+ # large hands on sides
281
+ # sign.data[:, 33:] *= 2
282
+ # sign.data[:, 33:54, 0] += 0.25
283
+ # sign.data[:, 54:, 0] -= 0.25
284
+
285
+ # hands moved to pose wrists
286
+ sign.data[:, 33:54, :3] += -sign.data[:, 33:34, :3] + sign.data[:, 15:16, :3]
287
+ sign.data[:, 54:, :3] += - sign.data[:, 54:55, :3] + sign.data[:, 16:17, :3]
288
 
289
  sign.save_animation(output_path, overwrite=True)
290
  else:
 
414
 
415
  gradio.Examples(
416
  [
417
+ ["We are here to use this.", "english", "pakistan-sign-language", "video"],
418
+ ["i(me) admire art.", "english", "pakistan-sign-language", "landmarks"],
419
  ["یہ بہت اچھا ہے۔", "urdu", "pakistan-sign-language", "video"],
420
  ["وہ کام آسان تھا۔", "urdu", "pakistan-sign-language", "landmarks"],
421
+ ["कैसे हैं आप?", "hindi", "pakistan-sign-language", "video"],
422
+ ["पाँच घंटे।", "hindi", "pakistan-sign-language", "landmarks"],
423
  ],
424
  inputs=[
425
  source_textbox,