Spaces:
Running
Running
import gradio as gr | |
from actionFunctions import * | |
def ttt_interface(): | |
with gr.Tab("Text-to-Text"): | |
with gr.Row(): | |
ttt_text_input = gr.TextArea(label="Input Text") | |
ttt_text_output = gr.TextArea(label="Generated Text") | |
with gr.Column(): | |
ttt_models = gr.Dropdown(["Model 1","Model 2", "Model 3"], label='Select a Model') | |
ttt_models.change(load_model, ttt_models, None) | |
with gr.Row(): | |
text_to_text_clear_button = gr.Button("Clear") | |
text_to_text_gen_button = gr.Button("Generate") | |
text_to_text_clear_button.click(fn_gen_text_to_text, None, ttt_text_output) | |
text_to_text_gen_button.click(fn_gen_text_to_text, ttt_text_input, ttt_text_output) | |
def tti_interface(): | |
with gr.Tab("Text-to-Image"): | |
with gr.Column(): | |
tti_image_output = gr.Image(label="Generated Image") | |
tti_text_input = gr.Textbox(label="Input Text") | |
with gr.Column(): | |
tti_models = gr.Dropdown(["SDXL","REALV6B1"], label='Select a Model') | |
output = gr.Textbox(label='Progress Output') | |
tti_models.change(load_model, tti_models, output) | |
text_to_image_gen_button = gr.Button("Generate") | |
text_to_image_gen_button.click(fn_gen_text_to_image, tti_text_input, tti_image_output) | |
def itt_interface(): | |
with gr.Tab("Image-to-text"): | |
with gr.Row(): | |
itt_image_input = gr.Image(label="Input Image") | |
itt_text_output = gr.Textbox(label="Generated Text") | |
with gr.Column(): | |
itt_models = gr.Dropdown(["Model 1","Model 2", "Model 3"], label='Select a Model') | |
itt_models.change(load_model, itt_models, None) | |
image_to_text_gen_button = gr.Button("Generate") | |
image_to_text_gen_button.click(fn_gen_image_to_text, itt_image_input, itt_text_output) | |