Duplicate from damo-vilab/modelscope-text-to-video-synthesis
Browse filesCo-authored-by: hysts <[email protected]>
- .gitattributes +34 -0
- .gitignore +162 -0
- .pre-commit-config.yaml +37 -0
- .style.yapf +5 -0
- README.md +13 -0
- app.py +104 -0
- requirements.txt +6 -0
- style.css +191 -0
.gitattributes
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
28 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
29 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
30 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
31 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
32 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
33 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
34 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
.gitignore
ADDED
@@ -0,0 +1,162 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
weights/
|
2 |
+
|
3 |
+
# Byte-compiled / optimized / DLL files
|
4 |
+
__pycache__/
|
5 |
+
*.py[cod]
|
6 |
+
*$py.class
|
7 |
+
|
8 |
+
# C extensions
|
9 |
+
*.so
|
10 |
+
|
11 |
+
# Distribution / packaging
|
12 |
+
.Python
|
13 |
+
build/
|
14 |
+
develop-eggs/
|
15 |
+
dist/
|
16 |
+
downloads/
|
17 |
+
eggs/
|
18 |
+
.eggs/
|
19 |
+
lib/
|
20 |
+
lib64/
|
21 |
+
parts/
|
22 |
+
sdist/
|
23 |
+
var/
|
24 |
+
wheels/
|
25 |
+
share/python-wheels/
|
26 |
+
*.egg-info/
|
27 |
+
.installed.cfg
|
28 |
+
*.egg
|
29 |
+
MANIFEST
|
30 |
+
|
31 |
+
# PyInstaller
|
32 |
+
# Usually these files are written by a python script from a template
|
33 |
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
34 |
+
*.manifest
|
35 |
+
*.spec
|
36 |
+
|
37 |
+
# Installer logs
|
38 |
+
pip-log.txt
|
39 |
+
pip-delete-this-directory.txt
|
40 |
+
|
41 |
+
# Unit test / coverage reports
|
42 |
+
htmlcov/
|
43 |
+
.tox/
|
44 |
+
.nox/
|
45 |
+
.coverage
|
46 |
+
.coverage.*
|
47 |
+
.cache
|
48 |
+
nosetests.xml
|
49 |
+
coverage.xml
|
50 |
+
*.cover
|
51 |
+
*.py,cover
|
52 |
+
.hypothesis/
|
53 |
+
.pytest_cache/
|
54 |
+
cover/
|
55 |
+
|
56 |
+
# Translations
|
57 |
+
*.mo
|
58 |
+
*.pot
|
59 |
+
|
60 |
+
# Django stuff:
|
61 |
+
*.log
|
62 |
+
local_settings.py
|
63 |
+
db.sqlite3
|
64 |
+
db.sqlite3-journal
|
65 |
+
|
66 |
+
# Flask stuff:
|
67 |
+
instance/
|
68 |
+
.webassets-cache
|
69 |
+
|
70 |
+
# Scrapy stuff:
|
71 |
+
.scrapy
|
72 |
+
|
73 |
+
# Sphinx documentation
|
74 |
+
docs/_build/
|
75 |
+
|
76 |
+
# PyBuilder
|
77 |
+
.pybuilder/
|
78 |
+
target/
|
79 |
+
|
80 |
+
# Jupyter Notebook
|
81 |
+
.ipynb_checkpoints
|
82 |
+
|
83 |
+
# IPython
|
84 |
+
profile_default/
|
85 |
+
ipython_config.py
|
86 |
+
|
87 |
+
# pyenv
|
88 |
+
# For a library or package, you might want to ignore these files since the code is
|
89 |
+
# intended to run in multiple environments; otherwise, check them in:
|
90 |
+
# .python-version
|
91 |
+
|
92 |
+
# pipenv
|
93 |
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
94 |
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
95 |
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
96 |
+
# install all needed dependencies.
|
97 |
+
#Pipfile.lock
|
98 |
+
|
99 |
+
# poetry
|
100 |
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
101 |
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
102 |
+
# commonly ignored for libraries.
|
103 |
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
104 |
+
#poetry.lock
|
105 |
+
|
106 |
+
# pdm
|
107 |
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
108 |
+
#pdm.lock
|
109 |
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
110 |
+
# in version control.
|
111 |
+
# https://pdm.fming.dev/#use-with-ide
|
112 |
+
.pdm.toml
|
113 |
+
|
114 |
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
115 |
+
__pypackages__/
|
116 |
+
|
117 |
+
# Celery stuff
|
118 |
+
celerybeat-schedule
|
119 |
+
celerybeat.pid
|
120 |
+
|
121 |
+
# SageMath parsed files
|
122 |
+
*.sage.py
|
123 |
+
|
124 |
+
# Environments
|
125 |
+
.env
|
126 |
+
.venv
|
127 |
+
env/
|
128 |
+
venv/
|
129 |
+
ENV/
|
130 |
+
env.bak/
|
131 |
+
venv.bak/
|
132 |
+
|
133 |
+
# Spyder project settings
|
134 |
+
.spyderproject
|
135 |
+
.spyproject
|
136 |
+
|
137 |
+
# Rope project settings
|
138 |
+
.ropeproject
|
139 |
+
|
140 |
+
# mkdocs documentation
|
141 |
+
/site
|
142 |
+
|
143 |
+
# mypy
|
144 |
+
.mypy_cache/
|
145 |
+
.dmypy.json
|
146 |
+
dmypy.json
|
147 |
+
|
148 |
+
# Pyre type checker
|
149 |
+
.pyre/
|
150 |
+
|
151 |
+
# pytype static type analyzer
|
152 |
+
.pytype/
|
153 |
+
|
154 |
+
# Cython debug symbols
|
155 |
+
cython_debug/
|
156 |
+
|
157 |
+
# PyCharm
|
158 |
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
159 |
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
160 |
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
161 |
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
162 |
+
#.idea/
|
.pre-commit-config.yaml
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
exclude: patch
|
2 |
+
repos:
|
3 |
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
4 |
+
rev: v4.2.0
|
5 |
+
hooks:
|
6 |
+
- id: check-executables-have-shebangs
|
7 |
+
- id: check-json
|
8 |
+
- id: check-merge-conflict
|
9 |
+
- id: check-shebang-scripts-are-executable
|
10 |
+
- id: check-toml
|
11 |
+
- id: check-yaml
|
12 |
+
- id: double-quote-string-fixer
|
13 |
+
- id: end-of-file-fixer
|
14 |
+
- id: mixed-line-ending
|
15 |
+
args: ['--fix=lf']
|
16 |
+
- id: requirements-txt-fixer
|
17 |
+
- id: trailing-whitespace
|
18 |
+
- repo: https://github.com/myint/docformatter
|
19 |
+
rev: v1.4
|
20 |
+
hooks:
|
21 |
+
- id: docformatter
|
22 |
+
args: ['--in-place']
|
23 |
+
- repo: https://github.com/pycqa/isort
|
24 |
+
rev: 5.12.0
|
25 |
+
hooks:
|
26 |
+
- id: isort
|
27 |
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
28 |
+
rev: v0.991
|
29 |
+
hooks:
|
30 |
+
- id: mypy
|
31 |
+
args: ['--ignore-missing-imports']
|
32 |
+
additional_dependencies: ['types-python-slugify']
|
33 |
+
- repo: https://github.com/google/yapf
|
34 |
+
rev: v0.32.0
|
35 |
+
hooks:
|
36 |
+
- id: yapf
|
37 |
+
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
|
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
title: ModelScope Text To Video Synthesis
|
3 |
+
emoji: 🚀
|
4 |
+
colorFrom: pink
|
5 |
+
colorTo: pink
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 3.22.1
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
duplicated_from: damo-vilab/modelscope-text-to-video-synthesis
|
11 |
+
---
|
12 |
+
|
13 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
@@ -0,0 +1,104 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env python
|
2 |
+
|
3 |
+
from __future__ import annotations
|
4 |
+
|
5 |
+
import os
|
6 |
+
import pathlib
|
7 |
+
import random
|
8 |
+
import shlex
|
9 |
+
import subprocess
|
10 |
+
|
11 |
+
import gradio as gr
|
12 |
+
import torch
|
13 |
+
from huggingface_hub import snapshot_download
|
14 |
+
|
15 |
+
if os.getenv('SYSTEM') == 'spaces':
|
16 |
+
subprocess.run(shlex.split('pip uninstall -y modelscope'))
|
17 |
+
subprocess.run(
|
18 |
+
shlex.split('git clone https://github.com/modelscope/modelscope'),
|
19 |
+
cwd='/tmp',
|
20 |
+
env={'GIT_LFS_SKIP_SMUDGE': '1'})
|
21 |
+
subprocess.run(shlex.split('git checkout fe67395'), cwd='/tmp/modelscope')
|
22 |
+
subprocess.run(shlex.split('pip install .'), cwd='/tmp/modelscope')
|
23 |
+
|
24 |
+
from modelscope.outputs import OutputKeys
|
25 |
+
from modelscope.pipelines import pipeline
|
26 |
+
|
27 |
+
model_dir = pathlib.Path('weights')
|
28 |
+
if not model_dir.exists():
|
29 |
+
model_dir.mkdir()
|
30 |
+
snapshot_download('damo-vilab/modelscope-damo-text-to-video-synthesis',
|
31 |
+
repo_type='model',
|
32 |
+
local_dir=model_dir)
|
33 |
+
|
34 |
+
DESCRIPTION = '# [ModelScope Text to Video Synthesis](https://modelscope.cn/models/damo/text-to-video-synthesis/summary)'
|
35 |
+
DESCRIPTION += '\n<p>For Colab usage, you can view <a href="https://colab.research.google.com/drive/1uW1ZqswkQ9Z9bp5Nbo5z59cAn7I0hE6R?usp=sharing" style="text-decoration: underline;" target="_blank">this webpage</a>.</p>'
|
36 |
+
DESCRIPTION += '\n<p>This model can only be used for non-commercial purposes. To learn more about the model, take a look at the <a href="https://huggingface.co/damo-vilab/modelscope-damo-text-to-video-synthesis" style="text-decoration: underline;" target="_blank">model card</a>.</p>'
|
37 |
+
if (SPACE_ID := os.getenv('SPACE_ID')) is not None:
|
38 |
+
DESCRIPTION += f'\n<p>For faster inference without waiting in queue, you may duplicate the space and upgrade to GPU in settings. <a href="https://huggingface.co/spaces/{SPACE_ID}?duplicate=true"><img style="display: inline; margin-top: 0em; margin-bottom: 0em" src="https://bit.ly/3gLdBN6" alt="Duplicate Space" /></a></p>'
|
39 |
+
|
40 |
+
pipe = pipeline('text-to-video-synthesis', model_dir.as_posix())
|
41 |
+
|
42 |
+
|
43 |
+
def generate(prompt: str, seed: int) -> str:
|
44 |
+
if seed == -1:
|
45 |
+
seed = random.randint(0, 1000000)
|
46 |
+
torch.manual_seed(seed)
|
47 |
+
return pipe({'text': prompt})[OutputKeys.OUTPUT_VIDEO]
|
48 |
+
|
49 |
+
|
50 |
+
examples = [
|
51 |
+
['An astronaut riding a horse.', 0],
|
52 |
+
['A panda eating bamboo on a rock.', 0],
|
53 |
+
['Spiderman is surfing.', 0],
|
54 |
+
]
|
55 |
+
|
56 |
+
with gr.Blocks(css='style.css') as demo:
|
57 |
+
gr.Markdown(DESCRIPTION)
|
58 |
+
with gr.Group():
|
59 |
+
with gr.Box():
|
60 |
+
with gr.Row(elem_id='prompt-container').style(equal_height=True):
|
61 |
+
prompt = gr.Text(
|
62 |
+
label='Prompt',
|
63 |
+
show_label=False,
|
64 |
+
max_lines=1,
|
65 |
+
placeholder='Enter your prompt',
|
66 |
+
elem_id='prompt-text-input').style(container=False)
|
67 |
+
run_button = gr.Button('Generate video').style(
|
68 |
+
full_width=False)
|
69 |
+
result = gr.Video(label='Result', show_label=False, elem_id='gallery')
|
70 |
+
with gr.Accordion('Advanced options', open=False):
|
71 |
+
seed = gr.Slider(
|
72 |
+
label='Seed',
|
73 |
+
minimum=-1,
|
74 |
+
maximum=1000000,
|
75 |
+
step=1,
|
76 |
+
value=-1,
|
77 |
+
info='If set to -1, a different seed will be used each time.')
|
78 |
+
|
79 |
+
inputs = [prompt, seed]
|
80 |
+
gr.Examples(examples=examples,
|
81 |
+
inputs=inputs,
|
82 |
+
outputs=result,
|
83 |
+
fn=generate,
|
84 |
+
cache_examples=os.getenv('SYSTEM') == 'spaces')
|
85 |
+
|
86 |
+
prompt.submit(fn=generate, inputs=inputs, outputs=result)
|
87 |
+
run_button.click(fn=generate, inputs=inputs, outputs=result)
|
88 |
+
|
89 |
+
with gr.Accordion(label='Biases and content acknowledgment', open=False):
|
90 |
+
gr.HTML("""<div class="acknowledgments">
|
91 |
+
<h4>Biases and content acknowledgment</h4>
|
92 |
+
<p>
|
93 |
+
Despite how impressive being able to turn text into video is, beware to the fact that this model may output content that reinforces or exacerbates societal biases. The training data includes LAION5B, ImageNet, Webvid and other public datasets. The model was not trained to realistically represent people or events, so using it to generate such content is beyond the model's capabilities.
|
94 |
+
</p>
|
95 |
+
<p>
|
96 |
+
It is not intended to generate content that is demeaning or harmful to people or their environment, culture, religion, etc. Similarly, it is not allowed to generate pornographic, violent and bloody content generation. <b>The model is meant for research purposes</b>.
|
97 |
+
</p>
|
98 |
+
<p>
|
99 |
+
To learn more about the model, head to its <a href="https://huggingface.co/damo-vilab/modelscope-damo-text-to-video-synthesis" style="text-decoration: underline;" target="_blank">model card</a>.
|
100 |
+
</p>
|
101 |
+
</div>
|
102 |
+
""")
|
103 |
+
|
104 |
+
demo.queue(api_open=False, max_size=15).launch()
|
requirements.txt
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
decord==0.6.0
|
2 |
+
fairseq==0.12.2
|
3 |
+
gradio==3.22.1
|
4 |
+
huggingface-hub==0.13.2
|
5 |
+
modelscope[multi-modal]==1.4.1
|
6 |
+
open_clip_torch==2.16.0
|
style.css
ADDED
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
This CSS file is copied from here:
|
3 |
+
https://huggingface.co/spaces/stabilityai/stable-diffusion/blob/2794a3c3ba66115c307075098e713f572b08bf80/app.py
|
4 |
+
*/
|
5 |
+
|
6 |
+
h1 {
|
7 |
+
text-align: center;
|
8 |
+
}
|
9 |
+
|
10 |
+
.gradio-container {
|
11 |
+
font-family: 'IBM Plex Sans', sans-serif;
|
12 |
+
}
|
13 |
+
|
14 |
+
.gr-button {
|
15 |
+
color: white;
|
16 |
+
border-color: black;
|
17 |
+
background: black;
|
18 |
+
}
|
19 |
+
|
20 |
+
input[type='range'] {
|
21 |
+
accent-color: black;
|
22 |
+
}
|
23 |
+
|
24 |
+
.dark input[type='range'] {
|
25 |
+
accent-color: #dfdfdf;
|
26 |
+
}
|
27 |
+
|
28 |
+
.container {
|
29 |
+
max-width: 730px;
|
30 |
+
margin: auto;
|
31 |
+
padding-top: 1.5rem;
|
32 |
+
}
|
33 |
+
|
34 |
+
#gallery {
|
35 |
+
min-height: 22rem;
|
36 |
+
margin-bottom: 15px;
|
37 |
+
margin-left: auto;
|
38 |
+
margin-right: auto;
|
39 |
+
border-bottom-right-radius: .5rem !important;
|
40 |
+
border-bottom-left-radius: .5rem !important;
|
41 |
+
}
|
42 |
+
|
43 |
+
#gallery>div>.h-full {
|
44 |
+
min-height: 20rem;
|
45 |
+
}
|
46 |
+
|
47 |
+
.details:hover {
|
48 |
+
text-decoration: underline;
|
49 |
+
}
|
50 |
+
|
51 |
+
.gr-button {
|
52 |
+
white-space: nowrap;
|
53 |
+
}
|
54 |
+
|
55 |
+
.gr-button:focus {
|
56 |
+
border-color: rgb(147 197 253 / var(--tw-border-opacity));
|
57 |
+
outline: none;
|
58 |
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
59 |
+
--tw-border-opacity: 1;
|
60 |
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
61 |
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px var(--tw-ring-offset-width)) var(--tw-ring-color);
|
62 |
+
--tw-ring-color: rgb(191 219 254 / var(--tw-ring-opacity));
|
63 |
+
--tw-ring-opacity: .5;
|
64 |
+
}
|
65 |
+
|
66 |
+
#advanced-btn {
|
67 |
+
font-size: .7rem !important;
|
68 |
+
line-height: 19px;
|
69 |
+
margin-top: 12px;
|
70 |
+
margin-bottom: 12px;
|
71 |
+
padding: 2px 8px;
|
72 |
+
border-radius: 14px !important;
|
73 |
+
}
|
74 |
+
|
75 |
+
#advanced-options {
|
76 |
+
display: none;
|
77 |
+
margin-bottom: 20px;
|
78 |
+
}
|
79 |
+
|
80 |
+
.footer {
|
81 |
+
margin-bottom: 45px;
|
82 |
+
margin-top: 35px;
|
83 |
+
text-align: center;
|
84 |
+
border-bottom: 1px solid #e5e5e5;
|
85 |
+
}
|
86 |
+
|
87 |
+
.footer>p {
|
88 |
+
font-size: .8rem;
|
89 |
+
display: inline-block;
|
90 |
+
padding: 0 10px;
|
91 |
+
transform: translateY(10px);
|
92 |
+
background: white;
|
93 |
+
}
|
94 |
+
|
95 |
+
.dark .footer {
|
96 |
+
border-color: #303030;
|
97 |
+
}
|
98 |
+
|
99 |
+
.dark .footer>p {
|
100 |
+
background: #0b0f19;
|
101 |
+
}
|
102 |
+
|
103 |
+
.acknowledgments h4 {
|
104 |
+
margin: 1.25em 0 .25em 0;
|
105 |
+
font-weight: bold;
|
106 |
+
font-size: 115%;
|
107 |
+
}
|
108 |
+
|
109 |
+
.animate-spin {
|
110 |
+
animation: spin 1s linear infinite;
|
111 |
+
}
|
112 |
+
|
113 |
+
@keyframes spin {
|
114 |
+
from {
|
115 |
+
transform: rotate(0deg);
|
116 |
+
}
|
117 |
+
|
118 |
+
to {
|
119 |
+
transform: rotate(360deg);
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
#share-btn-container {
|
124 |
+
display: flex;
|
125 |
+
padding-left: 0.5rem !important;
|
126 |
+
padding-right: 0.5rem !important;
|
127 |
+
background-color: #000000;
|
128 |
+
justify-content: center;
|
129 |
+
align-items: center;
|
130 |
+
border-radius: 9999px !important;
|
131 |
+
width: 13rem;
|
132 |
+
margin-top: 10px;
|
133 |
+
margin-left: auto;
|
134 |
+
}
|
135 |
+
|
136 |
+
#share-btn {
|
137 |
+
all: initial;
|
138 |
+
color: #ffffff;
|
139 |
+
font-weight: 600;
|
140 |
+
cursor: pointer;
|
141 |
+
font-family: 'IBM Plex Sans', sans-serif;
|
142 |
+
margin-left: 0.5rem !important;
|
143 |
+
padding-top: 0.25rem !important;
|
144 |
+
padding-bottom: 0.25rem !important;
|
145 |
+
right: 0;
|
146 |
+
}
|
147 |
+
|
148 |
+
#share-btn * {
|
149 |
+
all: unset;
|
150 |
+
}
|
151 |
+
|
152 |
+
#share-btn-container div:nth-child(-n+2) {
|
153 |
+
width: auto !important;
|
154 |
+
min-height: 0px !important;
|
155 |
+
}
|
156 |
+
|
157 |
+
#share-btn-container .wrap {
|
158 |
+
display: none !important;
|
159 |
+
}
|
160 |
+
|
161 |
+
.gr-form {
|
162 |
+
flex: 1 1 50%;
|
163 |
+
border-top-right-radius: 0;
|
164 |
+
border-bottom-right-radius: 0;
|
165 |
+
}
|
166 |
+
|
167 |
+
#prompt-container {
|
168 |
+
gap: 0;
|
169 |
+
}
|
170 |
+
|
171 |
+
#prompt-text-input,
|
172 |
+
#negative-prompt-text-input {
|
173 |
+
padding: .45rem 0.625rem
|
174 |
+
}
|
175 |
+
|
176 |
+
#component-16 {
|
177 |
+
border-top-width: 1px !important;
|
178 |
+
margin-top: 1em
|
179 |
+
}
|
180 |
+
|
181 |
+
.image_duplication {
|
182 |
+
position: absolute;
|
183 |
+
width: 100px;
|
184 |
+
left: 50px
|
185 |
+
}
|
186 |
+
|
187 |
+
#component-0 {
|
188 |
+
max-width: 730px;
|
189 |
+
margin: auto;
|
190 |
+
padding-top: 1.5rem;
|
191 |
+
}
|