Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Intelligent Frontends - Angular and Transformer...

Markus Ingvarsson
April 12, 2025
270

Intelligent Frontends - Angular and Transformers.js

Discover how Transformers.js enables Angular applications to deliver advanced AI capabilities directly in the browser, enhancing user experiences with powerful features.

Learn how to implement AI without relying on servers, ensuring privacy, speed, and scalability.

Through practical examples, we’ll explore how to seamlessly integrate these capabilities into your Angular apps. Achieve more with AI-powered features that take your projects to the next level.

Talk by Markus Ingvarsson @ ng-India 2025.

Markus Ingvarsson

April 12, 2025
Tweet

Transcript

  1. I N T E L L I G E N

    T F R O N T E N D S A N G U L A R A N D T R A N S F O R M E R S . J S @markusingvarssn
  2. S O M E R O U N D A

    B O U T @ D E L H I A I R P O R T
  3. I N T E L L I G E N

    T F R O N T E N D S A N G U L A R A N D T R A N S F O R M E R S J S After this talk, we will know about:
  4. I N T E L L I G E N

    T F R O N T E N D S A N G U L A R A N D T R A N S F O R M E R S J S After this talk, we will know about: • Why Client-side Machine Learning?
  5. I N T E L L I G E N

    T F R O N T E N D S A N G U L A R A N D T R A N S F O R M E R S J S After this talk, we will know about: • Why Client-side Machine Learning? • Transformers.js
  6. I N T E L L I G E N

    T F R O N T E N D S A N G U L A R A N D T R A N S F O R M E R S J S After this talk, we will know about: • Why Client-side Machine Learning? • Transformers.js • Adding Transformers.js to our Angular projects
  7. M A C H I N E L E A

    R N I N G I N 3 0 S E C O N D S
  8. M A C H I N E L E A

    R N I N G I N 3 0 S E C O N D S
  9. M A C H I N E L E A

    R N I N G I N 3 0 S E C O N D S f(x) Dog Cat
  10. W H Y C L I E N T- S

    I D E M A C H I N E L E A R N I N G ?
  11. W H Y C L I E N T- S

    I D E M A C H I N E L E A R N I N G ? - No network delay!
  12. W H Y C L I E N T- S

    I D E M A C H I N E L E A R N I N G ? - No network delay! https://www.keycdn.com/support/network-latency
  13. W H Y C L I E N T- S

    I D E M A C H I N E L E A R N I N G ? - No network delay! https://www.nvidia.com/sv-se/geforce/graphics-cards/
  14. W H Y C L I E N T- S

    I D E M A C H I N E L E A R N I N G ? - No network delay! https://www.nvidia.com/sv-se/geforce/graphics-cards/ https://en.wikipedia.org/wiki/WebGPU
  15. W E BGP U BR OWS E R S UP

    P ORT https://caniuse.com/webgpu
  16. W H Y C L I E N T- S

    I D E M A C H I N E L E A R N I N G ? - No network delay! - It is private (and therefore supported offline!)
  17. W H Y C L I E N T- S

    I D E M A C H I N E L E A R N I N G ? - No network delay! - It is private (and therefore supported offline!) - It is cost effective!
  18. W H Y C L I E N T- S

    I D E M A C H I N E L E A R N I N G ? - No network delay! - It is private (and therefore supported offline!) - It is cost effective!
  19. W H AT I S T R A N F

    O R M E R S . J S ? - Run pre-trained, state-of-the-art machine learning models in JavaScript
  20. W H AT I S T R A N F

    O R M E R S . J S ? - Run pre-trained, state-of-the-art machine learning models in JavaScript - Mirrors the Python transformers library
  21. W H AT I S T R A N F

    O R M E R S . J S ? - Run pre-trained, state-of-the-art machine learning models in JavaScript - Mirrors the Python transformers library - Supports 100+ model architectures across a wide domain of tasks
  22. I N S TA L L I N G T

    R A N S F O R M E R S . J S
  23. U S I N G T H E P I

    P E L I N E A P I
  24. U S I N G T H E P I

    P E L I N E A P I A pipeline in Transformers.js is a high-level abstract that bundles together:
  25. U S I N G T H E P I

    P E L I N E A P I A pipeline in Transformers.js is a high-level abstract that bundles together: - Pretrained model
  26. U S I N G T H E P I

    P E L I N E A P I A pipeline in Transformers.js is a high-level abstract that bundles together: - Pretrained model - Input preprocessing
  27. U S I N G T H E P I

    P E L I N E A P I A pipeline in Transformers.js is a high-level abstract that bundles together: - Pretrained model - Input preprocessing - Output postprocessing
  28. T R A N S F O R M E

    R S . J S - TA S K S Natural Language Processing - summarization - question-answering - sentence-similarity - sentiment-analysis - text-generation - translation - etc Vision - background-removal - depth-estimation - image-classification - image-segmentation - object-detection - etc Audio - audio-classification - automatic-speech- recognition - text-to-speech - etc … and more
  29. T R A N S F O R M E

    R S . J S - M O D E L S
  30. T R A N S F O R M E

    R S . J S - M O D E L S
  31. T R A N S F O R M E

    R S . J S - M O D E L S
  32. L E T ’ S B U I L D

    S O M E T H I N G I N A N G U L A R !
  33. S C R E E N D U M P

    F R O M M Y T H E S I S D A Y S
  34. L E T ’ S B U I L D

    A N O T H E R N O T E T A K I N G A P P
  35. T O D AY ’ S A P P -

    O V E R V I E W • Record audio from user’s device • Use a speech-to-text model from Transformers.js to transcribe the recording to create rich notes
  36. What are Web Workers? • Runs JavaScript in a separate

    thread • Keeps UI smooth during heavy work
  37. SUMMARY Thanks to Transformers.js and Angular, we can build ML-powered

    web apps that are Fast and responsive Private and offline support
  38. SUMMARY Thanks to Transformers.js and Angular, we can build ML-powered

    web apps that are Fast and responsive Private and offline-first Cost effective at scale
  39. FUTURE WORK – WHAT’S NEXT? • Train or fine-tune your

    own models! • Join the Huggingface community!
  40. FUTURE WORK – WHAT’S NEXT? • Train or fine-tune your

    own models! • Join the Huggingface community! • Get creative!
  41. A N G U L A R A N D

    T R A N S F O R M E R S . J S INTELLIGENT FRONTENDS Thank you! Markus Ingvarsson https://www.linkedin.com/in/markusingvarsson https://bsky.app/profile/markusingvarsson.bsky.social https://twitter.com/markusingvarssn http://if-ngindia.web.app/