File size: 1,475 Bytes
158667b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78e3b34
 
158667b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d6a11dd
158667b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d6a11dd
78e3b34
158667b
 
 
 
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
52
53
54
55
56
57
58
59
60
import argparse
import binascii
import glob
import os
import os.path
import numpy as np
import matplotlib.pyplot as plt
import random
import sys
import tempfile
import time
import torch
from PIL import Image
from diffusers import StableDiffusionPipeline

import gradio as gr

import artist_lib

from dotenv import load_dotenv
load_dotenv()
SERVER_NAME = os.getenv("SERVER_NAME")

drawdemo = gr.Interface(
    fn=artist_lib.draw,
    inputs=[
        gr.Text(label="Drawing description text", value="hindu mandala neon orange and blue"),
        gr.Dropdown(label='Model', choices=["stable-diffusion-2", "stable-diffusion-2-1", "stable-diffusion-v1-5"], value="stable-diffusion-v1-5"),
        gr.Checkbox(label="Force-New"),
    ],
    outputs="image",
        examples=[
        ['hindu mandala fruit salad', "stable-diffusion-v1-5", False]
    ],
)

with gr.Blocks() as gallerydemo:
    with gr.Column(variant="panel"):
        with gr.Row(variant="compact"):
            text = gr.Textbox(
                label="Enter your prompt",
                show_label=False,
                max_lines=1,
                placeholder="Enter your prompt"
            )
            btn = gr.Button("Generate image")

        gallery = gr.Gallery(
            label="Generated images", show_label=False, elem_id="gallery"
        )

    btn.click(artist_lib.fake_gan, None, gallery)

artist = gr.TabbedInterface( [drawdemo], ["Draw"])

artist.queue(
    max_size = 4
)
artist.launch()