|
import numpy as np |
|
import gradio as gr |
|
|
|
|
|
def textMode(text, count): |
|
return "In progress" |
|
|
|
|
|
def imageMode(image, question): |
|
return "In progress" |
|
|
|
def audioMode(audio): |
|
return "In progress" |
|
|
|
|
|
interface_title = "TSAI-ERA-V1 - Capstone - Multimodal GPT Demo" |
|
with gr.Blocks() as demo: |
|
with gr.Row(): |
|
gr.Markdown(f"<h1>{interface_title}</h1>", element_id="title") |
|
gr.Markdown("Choose text mode/image mode/audio mode for generation") |
|
with gr.Tab("Text mode"): |
|
text_input = gr.Textbox(placeholder="Enter a prompt", label="Input") |
|
text_input_count = gr.Textbox(placeholder="Enter number of characters you want to generate", label="Count") |
|
text_button = gr.Button("Submit") |
|
text_output = gr.Textbox(label="Chat GPT like text") |
|
with gr.Tab("Image mode"): |
|
with gr.Row(): |
|
image_input = gr.Image() |
|
image_text_input = gr.Textbox(placeholder="Enter a question/prompt around the image", label="Question/Prompt") |
|
image_button = gr.Button("Submit") |
|
image_text_output = gr.Textbox(label="Answer") |
|
|
|
with gr.Tab("Audio mode"): |
|
audio_input = gr.Audio() |
|
audio_button = gr.Button("Submit") |
|
audio_text_output = gr.Textbox(label="Chat GPT like text") |
|
|
|
|
|
text_button.click(textMode, inputs=[text_input, text_input_count], outputs=text_output) |
|
image_button.click(imageMode, inputs=[image_input,image_text_input], outputs=image_text_output) |
|
audio_button.click(audioMode, inputs=audio_input, outputs=audio_text_output) |
|
|
|
demo.launch() |