Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
from tensorflow.keras.models import load_model
|
4 |
+
import tensorflow as tf
|
5 |
+
import os
|
6 |
+
import torch
|
7 |
+
from diffusers import StableDiffusionPipeline
|
8 |
+
from torch import autocast
|
9 |
+
|
10 |
+
def txt2img(prompt):
|
11 |
+
|
12 |
+
image = pipe(prompt +",γrealistic, highly detailed, high quality", height=512, width=512, negative_prompt = "((low quality)),((poor quality)),((clone)),retro style, bad anatomy,((lowres)), blurry, (worst quality), ((low quality)), normal quality,bad anatomy, disfigured, deformed, mutation, mutilated, ugly, totem pole,(poorly drawn face), cloned face, several faces, long neck, mutated hands, bad hands, poorly drawn hands,extra limbs, malformed limbs, missing arms, missing fingers, extra fingers, fused fingers, too many fingers,missing legs, extra legs, malformed legs, extra digit, fewer digits, glitchy, cropped, jpeg artifacts, signature, watermark, username, text, errorretro style ,bad anatomy,((lowres)), blurry, (worst quality), normal quality,bad anatomy, disfigured, deformed, mutation, mutilated, ugly, totem pole,(poorly drawn face), cloned face, several faces, long neck, mutated hands, bad hands, poorly drawn hands,extra limbs, malformed limbs, missing arms, missing fingers, extra fingers, fused fingers, too many fingers,missing legs, extra legs, malformed legs, extra digit, fewer digits, glitchy, cropped, jpeg artifacts, signature, watermark, username, text, error", guidance_scale = 7.5,num_inference_steps = 50).images[0]
|
13 |
+
|
14 |
+
image.save("sd_image.png")
|
15 |
+
|
16 |
+
return image
|
17 |
+
|
18 |
+
generate = gr.Interface(fn = txt2img, inputs="text",outputs="image",allow_flagging="never")
|
19 |
+
|
20 |
+
|
21 |
+
generate.launch()
|