Ziqi commited on
Commit
1601fa4
1 Parent(s): ef070d7
Files changed (5) hide show
  1. .gitmodules +3 -0
  2. .pre-commit-config.yaml +35 -0
  3. .style.yapf +5 -0
  4. app.py +12 -9
  5. style.css +3 -0
.gitmodules ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ [submodule "ReVersion"]
2
+ path = ReVersion
3
+ url = https://github.com/ziqihuangg/ReVersion
.pre-commit-config.yaml ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v4.2.0
4
+ hooks:
5
+ - id: check-executables-have-shebangs
6
+ - id: check-json
7
+ - id: check-merge-conflict
8
+ - id: check-shebang-scripts-are-executable
9
+ - id: check-toml
10
+ - id: check-yaml
11
+ - id: double-quote-string-fixer
12
+ - id: end-of-file-fixer
13
+ - id: mixed-line-ending
14
+ args: ['--fix=lf']
15
+ - id: requirements-txt-fixer
16
+ - id: trailing-whitespace
17
+ - repo: https://github.com/myint/docformatter
18
+ rev: v1.4
19
+ hooks:
20
+ - id: docformatter
21
+ args: ['--in-place']
22
+ - repo: https://github.com/pycqa/isort
23
+ rev: 5.10.1
24
+ hooks:
25
+ - id: isort
26
+ - repo: https://github.com/pre-commit/mirrors-mypy
27
+ rev: v0.991
28
+ hooks:
29
+ - id: mypy
30
+ args: ['--ignore-missing-imports']
31
+ - repo: https://github.com/google/yapf
32
+ rev: v0.32.0
33
+ hooks:
34
+ - id: yapf
35
+ args: ['--parallel', '--in-place']
.style.yapf ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ [style]
2
+ based_on_style = pep8
3
+ blank_line_before_nested_class_or_def = false
4
+ spaces_before_comment = 2
5
+ split_before_logical_operator = true
app.py CHANGED
@@ -24,19 +24,22 @@ from inference import inference_fn
24
  # from trainer import Trainer
25
  # from uploader import upload
26
 
27
- TITLE = '# Custom Diffusion + StableDiffusion Training UI'
28
- DESCRIPTION = '''This is a demo for [https://github.com/adobe-research/custom-diffusion](https://github.com/adobe-research/custom-diffusion).
29
  It is recommended to upgrade to GPU in Settings after duplicating this space to use it.
30
- <a href="https://huggingface.co/spaces/nupurkmr9/custom-diffusion?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
31
  '''
32
  DETAILDESCRIPTION='''
33
- Custom Diffusion allows you to fine-tune text-to-image diffusion models, such as Stable Diffusion, given a few images of a new concept (~4-20).
34
- We fine-tune only a subset of model parameters, namely key and value projection matrices, in the cross-attention layers and the modifier token used to represent the object.
35
- This also reduces the extra storage for each additional concept to 75MB. Our method also allows you to use a combination of concepts. There's still limitations on which compositions work. For more analysis please refer to our [website](https://www.cs.cmu.edu/~custom-diffusion/).
36
- <center>
37
- <img src="https://huggingface.co/spaces/nupurkmr9/custom-diffusion/resolve/main/method.jpg" width="600" align="center" >
38
- </center>
39
  '''
 
 
 
 
 
 
 
 
40
 
41
  ORIGINAL_SPACE_ID = 'Ziqi/ReVersion'
42
  SPACE_ID = os.getenv('SPACE_ID', ORIGINAL_SPACE_ID)
 
24
  # from trainer import Trainer
25
  # from uploader import upload
26
 
27
+ TITLE = '# ReVersion'
28
+ DESCRIPTION = '''This is a demo for [https://github.com/ziqihuangg/ReVersion](https://github.com/ziqihuangg/ReVersion).
29
  It is recommended to upgrade to GPU in Settings after duplicating this space to use it.
30
+ <a href="https://huggingface.co/spaces/Ziqi/ReVersion?duplicate=true"><img src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
31
  '''
32
  DETAILDESCRIPTION='''
33
+ ReVersion
 
 
 
 
 
34
  '''
35
+ # DETAILDESCRIPTION='''
36
+ # Custom Diffusion allows you to fine-tune text-to-image diffusion models, such as Stable Diffusion, given a few images of a new concept (~4-20).
37
+ # We fine-tune only a subset of model parameters, namely key and value projection matrices, in the cross-attention layers and the modifier token used to represent the object.
38
+ # This also reduces the extra storage for each additional concept to 75MB. Our method also allows you to use a combination of concepts. There's still limitations on which compositions work. For more analysis please refer to our [website](https://www.cs.cmu.edu/~custom-diffusion/).
39
+ # <center>
40
+ # <img src="https://huggingface.co/spaces/nupurkmr9/custom-diffusion/resolve/main/method.jpg" width="600" align="center" >
41
+ # </center>
42
+ # '''
43
 
44
  ORIGINAL_SPACE_ID = 'Ziqi/ReVersion'
45
  SPACE_ID = os.getenv('SPACE_ID', ORIGINAL_SPACE_ID)
style.css ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ h1 {
2
+ text-align: center;
3
+ }