File size: 1,409 Bytes
33adbe7
9462800
 
daed9ab
712c171
9462800
 
 
75a78b0
daed9ab
9462800
fe15572
9462800
daed9ab
 
9462800
 
fe15572
9462800
fe15572
 
9462800
8ee75ad
75a78b0
9462800
3c7e7d2
ffcc874
9462800
 
 
 
3c7e7d2
 
 
9462800
3c7e7d2
ffcc874
c44c3ed
 
 
9462800
 
 
 
 
 
 
 
ab8f791
9462800
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
import random
import time


def add_text(history, text):
    history = history + [(text, None)]
    return history, gr.update(value="", interactive=False)


def add_file(history, file):
    history = history + [(('./outputs/a.png',), ('./outputs/a.png', './outputs/a.png'))]
    return history


def bot(history):
    response = "**That's cool!**"
    # history[-1][1] = ""
    for character in response:
        # history[-1][1] += character
        # time.sleep(0.05)
        yield history


with gr.Blocks() as demo:
    chatbot = gr.Chatbot([], label='Fooocus', height=750)

    with gr.Row():
        with gr.Column(scale=0.85):
            txt = gr.Textbox(
                show_label=False,
                placeholder="Type prompt here.",
                container=False
            )
        with gr.Column(scale=0.15, min_width=0):
            btn = gr.UploadButton("Generate", file_types=["image"])

    with gr.Row():
        gr.Checkbox(label='Advanced Setting', value=False, container=False)

    txt_msg = txt.submit(add_text, [chatbot, txt], [chatbot, txt], queue=False).then(
        bot, chatbot, chatbot
    )
    txt_msg.then(lambda: gr.update(interactive=True), None, [txt], queue=False)
    file_msg = btn.upload(add_file, [chatbot, btn], [chatbot], queue=False).then(
        bot, chatbot, chatbot
    )

demo.queue()  # number size style quality seed
demo.launch()