File size: 992 Bytes
de811b0
adc6d8b
be980dd
7c61b22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
adc6d8b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import gradio as gr


def process_text(text):
    return text


def process_image(image):
    return "image processed successfully"

def process_audio(audio):
    return "audio processed successfully"


with gr.Blocks() as iface:
    gr.Markdown("# this is my demo for tab feature")
    with gr.Tab("process Text"):
        text_input = gr.Textbox()
        text_output = gr.Textbox()
        text_button = gr.Button("process text")
    with gr.Tab("process Image"):
        image_input = gr.Image()
        image_output = gr.Textbox()
        image_button = gr.Button("process image")
    with gr.Tab("process Audio"):
        audio_input = gr.Audio()
        audio_output = gr.Textbox()
        audio_button = gr.Button("process audio")


    text_button.click(process_text, inputs=text_input, outputs=text_output)
    image_button.click(process_image, inputs=image_input, outputs=image_output)
    audio_button.click(process_audio, inputs=audio_input, outputs=audio_output)

iface.launch()