File size: 1,917 Bytes
463297f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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)