You are on page 1of 66

Generative AI

Workshop

Michael Chau
HKU Summer Institute
Table of contents
01 What is Artificial Intelligence?

02 What is Generative Artificial Intelligence?

03 Types of Generative AI

04 Live Demo of Generative AI Tools!

05 Pros and Cons of AI

2
What is AI?
● There is no universal definition. Here are some common ones:
○ Systems that think like humans
■ “machines with minds”

○ Systems that act like humans


■ “machine that perform functions that require intelligence when performed
by people”
■ “to make computers do things at which, at the moment, people are better”

○ Systems that think rationally


■ “the study of mental faculties through the use of computational models”

○ Systems that act rationally


■ “intelligent behavior in artifacts” 3
Thinking vs. Acting
● Thinking humanly
○ Cognitive science

○ Need to understand how humans think, perceive the environment, learn, etc.
● Thinking rationally
○ “right thinking” – irrefutable reasoning process

○ Logic
● Acting humanly or rationally
○ Focus on the behavior and output of the systems, rather than the reasoning
and thinking
process.
4
Acting Rationally
● Maximize goal achievement given the available
information.
● Doesn’t necessarily involve thinking.
● Doesn’t necessarily need to perform as well as human.

5
Acting Humanly: The Turing Test
● The Turing Test was designed to test whether an AI
system act humanly.
● A human interrogator (judge) interacts with two
subjects: a human and an AI system. The AI system
passes the test if the judge cannot tell which one is the
human.

6
Which one is a real person?

7
AI is multidisciplinary
● Philosophy
● Mathematics
● Economics
● Neuroscience
● Psychology
● Social science
● Linguistics
● Computer engineering
● Computer science
● Cognitive science
● Information Systems
8
State of the Art
● Autonomous planning and scheduling
● Game playing
● Autonomous control
● Medical diagnosis
● Logistics planning
● Robotics
● Language understanding and problem solving
● Prediction
● And many more…
9
Which of the following can be done by
computers/robots at present?
● Play a decent game of table tennis
● Drive a car
● Buy a week’s worth of food at a supermarket
● Buy a week’s worth of food on the Web
● Defeat the world champion in Chinese Chess
● Discover and prove new mathematical theorems
● Give competent legal advice in a specialized area of
law

10
Which of the following can be done by
computers/robots at present?
● Translate spoken English into spoken Swedish in real time
● Perform a complex surgical operation
● Play a soccer match with other “robot” teammates
● Chat with a human
● Vacuum-clean the floor of a house
● Take care of a baby

● https://www.youtube.com/watch?v=tF4DML7FIWk

11
Some High-level Tasks for AI
● Problem-solving
● Knowledge and reasoning
● Learning and prediction (data mining)
● Planning and optimization
● Perception (image and video recognition)
● Communication (speech analysis and synthesis)
● Creation
AI Techniques
● Most of the advanced AI techniques are based on deep learning
○ Learning from large amount of data (big data) using deep
models (e.g., neural networks, reinforcement learning)
AI Techniques
● Image recognition
● https://cloud.google.com/vision/
● https://cloud.google.com/video-intelligence/
AI Techniques
● Build your own model for image classification
● https://teachablemachine.withgoogle.com/
Application Case: Smart Retail
● Using various AI techniques in retail
● https://youtu.be/iLqfPPnS68s
Do you agree?
● “As computers do only what their programmers tell them to do,
they cannot be intelligent.”

● “As animals do only what their genes tell them to do, they
cannot be intelligent.”

● “As animals, humans, and computers do only what their


atoms/molecules tell them to do, they cannot be intelligent.”

17
Do you agree?
● “As computers do only what their programmers tell them to do,
they cannot be emotional.”

● “As animals do only what their genes tell them to do, they
cannot be emotional.”

● “As animals, humans, and computers do only what their


atoms/molecules tell them to do, they cannot be emotional.”

18
02
What is Generative
Artificial Intelligence?
(AI)
AI, Machine Learning,
and Deep Learning
Artificial Intelligence: a computer algorithm which
exhibits intelligence through decision making, such
that it can mimic human behaviors.

Machine Learning: A subset of AI, which can


automatically learn and improve without explicitly
being programmed.

Deep Learning: A subset of ML, which mimics human


brain by the use of deep (more than one layer of)
neural network layers.
20
Generative AI
Generative Artificial Intelligence (AI): a
branch of deep learning models that focuses
on generating new content, such as images,
music, text, or even videos, that mimic or
resemble content created by humans.

Once a generative AI algorithm has been


trained, it can produce new outputs that are
similar to the data it was trained on.

21
How does GAI work?
The most commonly used generative models for text / image creation are called
Generative Adversarial Networks (GANs) and Variational Autoencoders(VAEs).

22
Generative Adversarial Networks (GANs)

● 2 machine learning models are trained at


the same time
● One is called the generator and the other is
called the discriminator
● The generator’s job is to create new
outputs that resemble training data
● The discriminator’s job is to evaluate the
generated data and provide feedback to
the generator to improve its output
● As both models becomes more advanced,
the generator will generate results that are
hard for discriminator to discriminate
● Analogy: generator creates counterfeits
and discriminator tries to catch the fake
money.
23
Variational Autoencoders (VAEs)

● A single machine learning model is trained


● Encoder
○ Reduces data into a low-dimensional
representation that captures the data’s
important features, structure and relationships
in a smaller number of dimensions.
● Decoder
○ Magnifies the low-dimensional representation
back into the original data.
● It allows the model to learn a compact representation
of the data distribution, which it can then use to
generate new outputs.
03
Types of Generative AI

(AI)
Types of Generative AI
Some of the most common categories of generative AI includes:

(1) Text generation


Generative AI text generation uses advanced algorithms to produce human-like text for applications
like chatbots, content creation, and creative writing assistance. It can also write computer programs.

Examples: OpenAI GPT-4/ChatGPT, Llama V2, Falcon Chat, ChatNBX, Orimon AI, Perplexity AI

(2) Presentation file generation


Generative AI presentation file generation automates the creation of visually appealing slides,
incorporating relevant content and design elements for effective presentations.

Examples: Beautiful.AI, Slides AI, Canva, Powerpresent AI, Decktopus AI, Plus AI, Deckify

26
Types of Generative AI
(3) Image generation
Generative AI image generation employs advanced algorithms to create realistic and
novel images, enabling applications such as artwork generation, image synthesis, and
computer-aided design.

Examples: Stable Diffusion, Midjourney, NVIDIA GANs, DALL-E, Kittl, Getimg.ai,

(4) Image editing


Generative AI image editing involves using advanced algorithms to manipulate and
enhance images, enabling tasks such as style transfer, object removal, and image
restoration.

Examples: Adobe Photoshop (Beta), Remove.bg, Draggan, Deepswap, Luminar AI 27


Image generative fill
Image generative fill
Types of Generative AI
(5) Graphic design generation
Generative AI graphic design generation uses advanced algorithms to create visually
appealing designs, logos, and illustrations, streamlining the creative process.

Examples: Designs.AI, Canva, Adobe Sensei, LogoAI, Xinva, Unbound, Stockimg.AI

(6) Auto Video generation


AI video generation employs advanced algorithms to create realistic and dynamic
videos, applications include translating text or audio to videos.

Examples: Neural Frames, ModelScope Text-To-Video, Runway Gen-2, Typpo

30
Types of Generative AI
(7) Human-Cloning Avatars
Generative AI video cloning involves creating a replica video with a target person's appearance and
movements, enabling applications such as virtual avatars, digital doubles, and personalized video
content.

Examples: Avatarify, DeepFaceLab, Deepbrain, Synthesia, Pixificial, Selfie Vibe

(8) Video auto-editing


Generative AI video auto-editing uses algorithms to automatically analyze and edit videos, enabling
applications such as video summarization, highlight reel creation, and intelligent video editing.

Examples: Magisto, Adobe Premiere Pro Auto Reframe, Clipchamp Create, FineCam, Nova AI

31
Types of Generative AI
(9) Audio generation
Generative AI audio generation employs advanced algorithms to create synthetic audio,
enabling applications such as music composition, speech synthesis, and sound design.

Examples: Elevenlabs, HF Voice-Cloning, Voicemod, Listnr 2.0, Murf.AI, TTSLabs

(10) Music generation


Generative AI music generation employs advanced algorithms to compose original
music, enabling applications such as music composition, soundtrack creation, and
personalized music experiences.

Examples: HF MusicGen, MusicLM, Synthesizer V, Text-To-Song, Emergent Drums


32
04
Demo session

(AI)
Tools to be covered
● AI image generator - Stable Diffusion
● AI Voice Clone - Hugging Face Voice Cloning
● Music Generation - HF MusicGen
● AI Image Tweaking - Draggan
● Story Generation - FictionGPT

34
1. AI Image Generator - Stable Diffusion
https://huggingface.co/spaces/stabilityai/stable-diffusion

AI Image Generator

● Enter prompt:
Keywords, descriptives that describe the image
you want to generate
● Enter negative prompt: (optional)
Keywords and ideas that the model should avoid
generating
● Generate image!

36
https://huggingface.co/spaces/stabilityai/stable-diffusion

How do I write
good prompts?
https://huggingface.co/spaces/stabilityai/stable-diffusion

Tip #1: Be As Specific as You Can

Can you spot out the difference?


Prompt 1: "Cute Cat"
Prompt 2: "Cute Grey Cat"
Prompt 3: "Cute Grey Cat with blue eyes, wearing a bowtie"

38
https://huggingface.co/spaces/stabilityai/stable-diffusion

Tip #2: Name Specific Art Styles or Mediums / Artists

Naming out specific art styles could greatly help the AI understand your request!
Prompt 1: "Cute Grey Cat, acrylic painting"
Prompt 2: "Cute Grey Cat, Unreal Engine rendering"
Prompt 3: "bust of a cat in a walmart, clay model, (psychedelic colors), melting, weird"

39
https://huggingface.co/spaces/stabilityai/stable-diffusion

Tip #3: Take reference of the Art Generation community

● Some major AI art community,


such as Lexica
(https://lexica.art/) and CivitAI
(https://civitai.com/) are great
resources for inspirations!
● If you use MidJourney, the
Discord server for MidJourney
is also very active and
interesting.
https://huggingface.co/spaces/stabilityai/stable-diffusion

Examples
Cat Breed

a Ragdoll Cat as the doomslayer,


Keywords
realistic scifi cyberpunk power Portrait
armor robot, closeup portrait art by
Artist(s)
donato giancola and greg Styles

rutkowski, vintage retro scifi,


realistic face, digital art, trending
on artstation, symmetry

41
https://huggingface.co/spaces/stabilityai/stable-diffusion

Jaw-dropping results!
Try it out!
100 free image generation / month

https://huggingface.co/spaces/stabilityai/stable-diffusion

https://lexica.art/

43
2. AI Voice Clone - Hugging Face Voice Cloning
https://huggingface.co/spaces/BilalSardar/Voice-Cloning

AI Voice Cloning

1. Enter the word to be said


2. Upload a voice of yours
3. Click "Submit" to generate the
synthesized voice

45
https://huggingface.co/spaces/BilalSardar/Voice-Cloning

AI Voice Cloning

1. Enter the word to be said


2. Upload a voice of yours
3. Click "Submit" to generate
the synthesized voice
46
3. AI Music Generation
https://huggingface.co/spaces/facebook/MusicGen

AI Music Generation

1. Enter the keywords to describe


your music
2. Upload a melody by a file or using
your mic (optional)
3. Click "Generate" to create the
music 48
4. AI Image Tweaking - Draggan
https://openxlab.org.cn/apps/detail/XingangPan/DragGAN
https://huggingface.co/spaces/DragGan/DragGan

AI Image Tweaking

50
https://openxlab.org.cn/apps/detail/XingangPan/DragGAN
https://huggingface.co/spaces/DragGan/DragGan

How to use?
● Quick Start
○ Select desired Pretrained Model and adjust Seed to generate an initial image.
○ Click on image to add control points.
○ Click Start and enjoy it!
● Advanced Usage
○ Change Step Size to adjust learning rate in drag optimization.
○ Select w or w+ to change latent space to optimize:
○ Optimize on w space may cause greater influence to the image.
○ Optimize on w+ space may work slower than w, but usually achieve better results.
○ Note that changing the latent space will reset the image, points and mask (this has the same
effect as Reset Image button).
○ Click Edit Flexible Area to create a mask and constrain the unmasked region to remain
unchanged.

51
5. Story Generation - FictionGPT
https://fictiongpt.xyz/

Story Generation

53
54
The Summer School Surprise
Once upon a time in the bustling city of Hong Kong, a group of students from all over the world gathered at the prestigious University of Hong Kong for a summer school program
on business analytics and generative AI. These bright young minds had come with the hope of expanding their knowledge and learning from the best in the field.

On the first day of the program, the students were excited to meet their teachers, Professor Thompson and Professor Lee. The professors were renowned experts, known for their
extensive research and witty personalities. They had a unique teaching style that blended humor into their lectures, making the classes not only informative but also enjoyable.

As the days rolled on, the students found themselves engrossed in their studies. They attended lectures on data analysis, machine learning, and predictive modeling. The
professors used real-world examples as case studies, making it easier for the students to understand complex concepts.

One afternoon, Professor Thompson decided to surprise his students with a hands-on activity. He divided them into groups and gave each group a business scenario to analyze.
Their task was to use the knowledge they had acquired to come up with a comprehensive business plan.

The students enthusiastically embraced the challenge. They brainstormed ideas, analyzed data, and built predictive models to support their plans. The atmosphere was filled
with excitement and laughter as each group presented their strategies.

Little did the students know, Professor Thompson had a mischievous side. He had secretly modified the AI algorithm they were using for their analysis. Instead of generating
precise predictions, he had programmed it to produce outrageous and unbelievable outcomes.

When the first group presented their plan, the AI predicted that they would make a fortune by selling flamethrower umbrellas to mermaids in Antarctica. The room erupted with
laughter and applause. The students couldn't believe their ears, but they knew it was the professor's doing.

The second group proposed a business idea that involved breeding unicorns and selling their magical horns as fashion accessories. The AI model, true to its mischievous
programming, predicted that their profits would skyrocket as unicorns became the hottest trend. The room once again burst into laughter.

As each group presented, the predictions became more absurd and comical. The AI suggested opening a chain of cat cafes that would be run entirely by laser-wielding robots,
starting an intergalactic delivery service using teleportation, and even launching a line of levitating shoes for humans.

The students couldn't help but admire the creativity of Professor Thompson's prank. They applauded and laughed uproariously, enjoying the unexpected turn of events. The
professors were delighted to see their students thoroughly engaged and embracing humor in their learning process.

In the end, while the predictions were outrageous, the exercise taught the students an important lesson – to think outside the box and challenge conventional wisdom. The
summer school became an unforgettable experience for all involved, and the students left with not only a solid understanding of business analytics and generative AI but also
with memories of laughter and camaraderie.

And so, as the sun set over the University of Hong Kong, the students bid farewell to their professors, grateful for the wisdom they had gained and the laughter they had shared. 55
They knew that this summer school had been truly exceptional, a unique blend of education and comedy that would stay with them forever.
56
Summer Love
Once upon a time, in the bustling city of Hong Kong, a group of students gathered at the prestigious University of Hong Kong for a summer school program. They were an eclectic
mix of individuals from various backgrounds, all eager to expand their knowledge in the field of business analytics and generative AI. Little did they know that this summer would
be more than just an educational experience, it would be a summer of love.

Among the students was Sarah, a bright and ambitious young woman with a passion for data analysis. She was known for her intelligence and dedication to her studies. Her
radiant smile and warm personality drew people towards her effortlessly.

One sunny afternoon, during a break between classes, Sarah found herself sitting alone in the university courtyard. Lost in her thoughts, she was interrupted by a voice that sent
shivers down her spine. It was James, a charming and charismatic student from another program. His piercing blue eyes and captivating smile made Sarah's heart skip a beat.

As fate would have it, James was also enrolled in the business analytics course. They quickly found common ground and spent countless hours studying together, their
connection growing stronger with each passing day. They admired each other's intellect and complemented each other perfectly.

One evening, after a long day of lectures and discussions, Sarah and James decided to explore the enchanting streets of Hong Kong. The city's vibrant energy created a romantic
ambiance. The neon lights reflected off their faces, giving them an otherworldly glow. They laughed and talked, sharing their dreams and aspirations, as if they had known each
other for a lifetime.

In the midst of their exploration, Sarah and James stumbled upon a quaint café tucked away in a narrow alley. The aroma of freshly brewed coffee enticed their senses, and they
couldn't resist entering. As they sipped their lattes, they gazed into each other's eyes, feeling an unspoken connection between them.

Days turned into weeks, and their friendship evolved into something deeper. Sarah and James became inseparable, their lives intertwined in a dance of passion and affection.
They studied together, worked on projects together, and supported each other's goals and dreams.

Finally, the summer came to an end, and the students had to bid farewell to their beloved university and return to their respective lives. Sarah and James knew that their love was
not bound by time or distance. They promised to stay in touch and continue their journey together.

Months turned into years, and Sarah and James navigated the challenges of long-distance love with grace and perseverance. With each passing day, their love grew stronger,
fueled by their shared passion for business analytics and generative AI.

One day, James surprised Sarah with a plane ticket to Hong Kong. He had been offered a job at a prestigious analytics firm, and he wanted to be close to her. They realized that
their love had transcended the walls of the university and blossomed into something beautiful.

And so, in the heart of Hong Kong, Sarah and James found themselves again, immersed in their shared passion for learning and love. Together, they built a life filled with success,
happiness, and an everlasting romance that began during that fateful summer at the University of Hong Kong. 57
Other example: computer program writing

58
05
Advantages and Disadvantages
of AI
(AI)

59
Pros
(+) Automation of repetitive tasks
AI makes our daily life much easier, as machines can perform tasks
that are difficult for us automatically
(+) Reduces human error
Fewer errors, since there is little human involvement and the tasks
are performed automatically, the probability of error is greatly
reduced

60
Pros
(+) More room for creativity
It favors the creative process of humans, since it leaves us with more time
to think freely about future tasks or work actions.
It can also provide insights.

(+) Decision making


When making decisions, AI plays a fundamental role due to its agility in
the search and connection of information and also the analysis of the data
collected

61
Cons
(-) Difficulty of access to data
For an artificial intelligence to work properly, it must have updated
and reliable data. However, sometimes the machine learning model
does not have all the necessary/most updated data to make
decisions.

(-) Developing them is expensive


In order to replace or match the human figure with machines, it is
essential to have a large amount of money that can cover the
necessary development and maintenance costs of these tools.

62
Cons
(-) Lack of qualified professionals
The number of qualified professionals who can handle these
tools is limited.

(-) Limiting human creativity


With the reliance on AI generated content, if humans don't
exercise their creativity or fail to be rewarded by it, creativity
will be lost.

63
Cons
(-) Ethical and legal issues
Do AI make ethical discussions?
If AI makes a mistake, who is legally responsible for it?

64
Questions?

You might also like