Spaces:
Sleeping
Sleeping
| """ App | |
| """ | |
| import gradio as gr | |
| import time | |
| import os | |
| import torch | |
| import spaces | |
| from diffusers import StableDiffusionInstructPix2PixPipeline, EulerAncestralDiscreteScheduler | |
| from diffusers.utils import load_image | |
| device = "cuda" if torch.cuda.is_available() else "cpu" | |
| model_repo_id = "timbrooks/instruct-pix2pix" | |
| if torch.cuda.is_available(): | |
| torch_dtype = torch.float16 | |
| else: | |
| torch_dtype = torch.float32 | |
| pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained( | |
| model_repo_id, | |
| torch_dtype=torch_dtype, | |
| safety_checker=None | |
| ) | |
| pipe = pipe.to(device) | |
| pipe.scheduler = EulerAncestralDiscreteScheduler.from_config(pipe.scheduler.config) | |
| def greet(name): | |
| return "Hello there {}".format(name) | |
| # comment updated 2 | |
| iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
| iface.launch() | |