0
0
Prompt Engineering / GenAIml~10 mins

GenAI applications (text, image, code, audio) - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to generate text using a GenAI model.

Prompt Engineering / GenAI
generated_text = model.[1](prompt)
Drag options to blanks, or click blank then click option'
Agenerate
Bpredict
Cfit
Dtrain
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'predict' instead of 'generate' because 'predict' is for classification.
2fill in blank
medium

Complete the code to load a pretrained GenAI image model.

Prompt Engineering / GenAI
image_model = GenAIImageModel.[1]('pretrained-model')
Drag options to blanks, or click blank then click option'
Atrain
Bsave
Cload
Dfit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'train' which starts training instead of loading.
3fill in blank
hard

Fix the error in the code to generate audio from text.

Prompt Engineering / GenAI
audio_output = audio_model.[1](text_input)
Drag options to blanks, or click blank then click option'
Atrain
Bpredict
Cfit
Dsynthesize
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'predict' which is for classification, not audio generation.
4fill in blank
hard

Fill both blanks to create a code snippet that generates code from a prompt and runs it.

Prompt Engineering / GenAI
generated_code = code_model.[1](prompt)
exec([2])
Drag options to blanks, or click blank then click option'
Agenerate
Brun
Cgenerated_code
Dcode
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' as a method on the model, which does not exist.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps audio clips to their durations if duration is greater than 5 seconds.

Prompt Engineering / GenAI
audio_durations = {clip: [1] for clip in audio_clips if [2] > [3]
Drag options to blanks, or click blank then click option'
Aclip.duration
C5
Dlen(clip)
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'len(clip)' which may not represent duration.