|
import gradio as gr |
|
import os |
|
import sys |
|
from pathlib import Path |
|
import time |
|
import random |
|
from PIL import Image |
|
""" |
|
import os |
|
import gradio as gr |
|
|
|
|
|
|
|
|
|
""" |
|
API_KEY=os.environ.get('HUGGING_FACE_HUB_TOKEN', None) |
|
|
|
article = "test" |
|
models2 =[ |
|
"", |
|
"Schisim/Clarity", |
|
"jzli/DreamShaper-3.32", |
|
] |
|
models =[ |
|
"", |
|
"CompVis/stable-diffusion-v1-4", |
|
"runwayml/stable-diffusion-v1-5", |
|
"prompthero/openjourney", |
|
|
|
"stabilityai/stable-diffusion-2-1", |
|
"stabilityai/stable-diffusion-2-1-base", |
|
"andite/anything-v4.0", |
|
|
|
"Linaqruf/anything-v3.0", |
|
"eimiss/EimisAnimeDiffusion_1.0v", |
|
"nitrosocke/Nitro-Diffusion", |
|
|
|
"wavymulder/portraitplus", |
|
"22h/vintedois-diffusion-v0-1", |
|
"dreamlike-art/dreamlike-photoreal-2.0", |
|
|
|
"dreamlike-art/dreamlike-diffusion-1.0", |
|
"wavymulder/Analog-Diffusion", |
|
"nitrosocke/redshift-diffusion", |
|
"claudfuen/photorealistic-fuen-v1", |
|
"prompthero/openjourney-v2", |
|
"johnslegers/epic-diffusion", |
|
"nitrosocke/Arcane-Diffusion", |
|
"darkstorm2150/Protogen_x5.8_Official_Release", |
|
|
|
] |
|
|
|
model_1=models[1] |
|
model_2=models[2] |
|
model_3=models[3] |
|
model_4=models[4] |
|
model_5=models[5] |
|
model_6=models[6] |
|
model_7=models[7] |
|
model_8=models[8] |
|
model_9=models[9] |
|
model_10=models[10] |
|
model_11=models[11] |
|
model_12=models[12] |
|
model_13=models[13] |
|
model_14=models[14] |
|
model_15=models[15] |
|
model_16=models[16] |
|
model_17=models[17] |
|
model_18=models[18] |
|
model_19=models[19] |
|
model_20=models[20] |
|
|
|
|
|
proc1=gr.Interface.load(f"models/{model_1}",live=False,preprocess=True, postprocess=False) |
|
proc2=gr.Interface.load(f"models/{model_20}",live=False,preprocess=True, postprocess=False) |
|
proc3=gr.Interface.load(f"models/{model_17}",live=False,preprocess=True, postprocess=False) |
|
|
|
""" |
|
ppComic=gr.Interface.load( |
|
name="models/ogkalu/Comic-Diffusion", |
|
title="Comic Diffusion", |
|
description="Demo for <a href='https://huggingface.co/ogkalu/Comic-Diffusion'>Comic Diffusion</a> Stable Diffusion model.", |
|
article=article, |
|
api_key=API_KEY, |
|
)#.queue(concurrency_count=20).launch() |
|
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def randStr(): |
|
pp=["a","b","c","d","e","f","g","h"] |
|
str=""; |
|
str+=random.choice(pp)+random.choice(pp)+random.choice(pp) |
|
str+=random.choice(pp)+random.choice(pp)+random.choice(pp) |
|
str+=random.choice(pp)+random.choice(pp)+random.choice(pp) |
|
str+=random.choice(pp)+random.choice(pp)+random.choice(pp) |
|
return str |
|
|
|
def bbb22(text): |
|
|
|
return text[::-1] |
|
|
|
|
|
with gr.Blocks() as demo: |
|
with gr.Row(): |
|
with gr.Column(): |
|
english = gr.Textbox(label="English text") |
|
btn01 = gr.Button(value="btn01") |
|
with gr.Column(): |
|
german = gr.Textbox(label="German Text") |
|
with gr.Row(): |
|
img1=gr.Image() |
|
img2=gr.Image() |
|
img3=gr.Image() |
|
with gr.Row(): |
|
btn2 = gr.Button(value="btn2") |
|
btn3 = gr.Button(value="btn3") |
|
btn4 = gr.Button(value="btn4") |
|
with gr.Row(): |
|
img4=gr.Image() |
|
btn5 = gr.Button(value="btn4") |
|
|
|
def iimg(text): |
|
return ("girl "+randStr()+" "+text) |
|
|
|
btn01.click(iimg, inputs=english, outputs=english) |
|
|
|
btn2.click(proc1,inputs=english,outputs=img1) |
|
btn3.click(proc2,inputs=english,outputs=img2) |
|
btn4.click(proc3,inputs=english,outputs=img3) |
|
|
|
|
|
|
|
examples = gr.Examples(examples=["I went to the supermarket yesterday.", "Helen is a good swimmer."], |
|
inputs=[english]) |
|
|
|
print("\nabc01aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\n") |
|
demo.launch() |
|
|