Fung804 commited on
Commit
219b0d3
β€’
1 Parent(s): 192f271

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -30
app.py CHANGED
@@ -1,32 +1,3 @@
1
- pip install diffusers
2
- pip install diffusers==0.9.0
3
- import diffusers
4
-
5
- from tensorflow.keras.models import load_model
6
- import cv2
7
- import tensorflow as tf
8
- import os
9
- from matplotlib import pyplot as plt
10
- import numpy as np
11
- import torch
12
- from diffusers import StableDiffusionPipeline
13
- from torch import autocast
14
- import gradio
15
  import gradio as gr
16
 
17
- pipe = StableDiffusionPipeline.from_pretrained("Fung804/makoto-shinkai-v2", torch_dtype=torch.float16)
18
- pipe = pipe.to("cuda")
19
-
20
- def txt2img(prompt):
21
-
22
- 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]
23
-
24
- image.save("sd_image.png")
25
-
26
- return image
27
-
28
-
29
- generate = gr.Interface(fn = txt2img, inputs="text",outputs="image",allow_flagging="never")
30
-
31
- generate.launch(inline = False)
32
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
 
3
+ gr.Interface.load("Fung804/makoto-shinkai-v2").launch()