# Đầu tiên, cài đặt Gradio
!pip install --quiet gradioimport numpy as np

def sepia(image):
    sepia_filter = np.array(
        [[0.393, 0.769, 0.189], 
         [0.349, 0.686, 0.168], 
         [0.272, 0.534, 0.131]]
    )
    sepia_img = image.dot(sepia_filter.T)
    sepia_img /= sepia_img.max()
    return sepia_imgimport gradio as gr

# Viết 1 dòng mã Python để tạo ra giao diện đơn giản
gr.Interface(fn=sepia, inputs="image", outputs="image").launch();import numpy as np
import gradio as gr

def generate_tone(note, octave, duration):
    sampling_rate = 48000
    a4_freq, tones_from_a4 = 440, 12 * (octave - 4) + (note - 9)
    frequency = a4_freq * 2 ** (tones_from_a4 / 12)
    audio = np.linspace(0, int(duration), int(duration) * sampling_rate)
    audio = (20000 * np.sin(audio * (2 * np.pi * frequency))).astype(np.int16)
    return sampling_rate, audio

gr.Interface(
    generate_tone,
    [
        gr.Dropdown(["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"], type="index"),
        gr.Slider(4, 6, step=1),
        gr.Number(value=1, label="Duration in seconds"),
    ],
    "audio",
    title="Generate a Musical Tone!"
).launch()import gradio as gr

gr.Interface.load("huggingface/facebook/fastspeech2-en-ljspeech").launch();import gradio as gr

examples = [["The Moon's orbit around Earth has"], ["There once was a pineapple"]]

gr.Interface.load("huggingface/EleutherAI/gpt-j-6B", examples=examples).launch();from IPython.display import IFrame
IFrame(src='https://hf.space/gradioiframe/abidlabs/Draw/+', width=1000, height=800)