logo
Friday 1 year ago
parent
commit
9f03dc11f1
  1. 49
      README.md
  2. 5
      __init__.py
  3. BIN
      a corgi.png
  4. BIN
      an orange cat.png
  5. 24
      main.py

49
README.md

@ -1,39 +1,52 @@
# Overview
## Title
Stable Diffusion Model is a software framework that allows users to implement and simulate diffusion processes in various fields.It is capable of generating a number of high-quality, high-revolution images with the respective prompts that users type in.This README provides an introduction and guidelines for using the Stable Diffusion.
Text2image implementation through StableDiffusion
## Overview
1.Features
Stable Diffusion is a software library that provides efficient and accurate algorithms for solving diffusion equations numerically. It is designed to handle diffusion problems in various scientific and engineering fields, such as heat transfer, fluid dynamics, and chemical reactions.
## Author
① Efficient and scalable algorithms for solving large-scale diffusion problems
- Xiaoyin Chang(3270939387@qq.com)
②Visualization tools for analyzing and visualizing the simulated results
③Visualization tools for analyzing and visualizing the simulated results
## Features
④Visualization tools for analyzing and visualizing the simulated results
- Efficient and scalable algorithms for solving large-scale diffusion problems
2.example
- Visualization tools for analyzing and visualizing the simulated results
You can see the codes in the main archive and easily starting your diffusion trip.For your reference ,if you type in a prompt named 'an orange cat' or 'a corgi',you can obtain the following images.
![图片1.png](..%2F..%2FUsers%2F%B3%A3%E4%EC%D2%FC%2FDesktop%2F%CD%BC%C6%AC1.png)
![图片2.png](..%2F..%2FUsers%2F%B3%A3%E4%EC%D2%FC%2FDesktop%2F%CD%BC%C6%AC2.png)
- Numerical solution of diffusion equations with different boundary conditions
3.Contributing
- Support for various discretization schemes, including finite difference, finite element, and spectral methods
If you find any issues or have suggestions for improvements, please submit them through the GitHub issue tracker. Contributions to the Stable Diffusion are welcome. You can fork the repository, make your changes, and submit a pull request.
Please ensure that your contributions adhere to the coding conventions and style guidelines outlined in the repository.
## Code example
import torch
from diffusers import StableDiffusionPipeline, DPMSolverMultistepScheduler
4.License
model_id = "stabilityai/stable-diffusion-2-1"
Stable Diffusion is licensed under the [MIT License](https://opensource.org/licenses/MIT). You are free to use, modify, and distribute the library in accordance with the terms of this license.
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
5.Contact
#pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
If you have any questions or need further assistance, feel free to reach out to the development team at `3270939387@qq.com`. We would be happy to assist you.
prompt = "an orange cat"/“a corgi”
image = pipe(prompt).images[0]
image.save("orange_cat.png"/“corgi.png”)
The image results are also availble in the repository,please feel free to have a look!
## Contributing
If you find any issues or have suggestions for improvements, please submit them through the GitHub issue tracker. Contributions to the Stable Diffusion are welcome. You can fork the repository, make your changes, and submit a pull request.
Please ensure that your contributions adhere to the coding conventions and style guidelines outlined in the repository.
## License
Stable Diffusion is licensed under the MIT License. You are free to use, modify, and distribute the library in accordance with the terms of this license.
## Contact
If you have any questions or need further assistance, feel free to reach out to the development team at 3270939387@qq.com. We would be happy to assist you.

5
__init__.py

@ -0,0 +1,5 @@
from diffusers import StableDiffusionPipeline,DPMSolverMultistepSchedule
from towhee.operator import PyOperator
def stablediffusion(*args,**kwargs):
return image

BIN
a corgi.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 KiB

BIN
an orange cat.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 488 KiB

24
main.py

@ -1,19 +1,3 @@
# This is a sample Python script.
# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.
def print_hi(name):
# Use a breakpoint in the code line below to debug your script.
print(f'Hi, {name}') # Press Ctrl+F8 to toggle the breakpoint.
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
print_hi('PyCharm')
# See PyCharm help at https://www.jetbrains.com/help/pycharm/
import logging
import torch
from diffusers import StableDiffusionPipeline, DPMSolverMultistepSchedule
@ -21,14 +5,14 @@ from towhee.operator import PyOperator
log = logging.getLogger(PyOperator)
class Generation(PyOperator):
class StableDiffusion(PyOperator):
def __init__(self,model_id='stabilityai/stable-diffusion-2-1'):
self._model_id=model_id
def __call__(self, *args, **kwargs):
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
def __call__(self, prompt:str):
self.pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float32)
# pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
prompt = "an orange cat"
image = pipe(prompt).images[0]
return image

Loading…
Cancel
Save