LanguageBind's picture
Update opensora/serve/gradio_utils.py
bc28cf1 verified
import random
import torch
def set_env(seed=0):
torch.manual_seed(seed)
torch.set_grad_enabled(False)
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
if randomize_seed:
seed = random.randint(0, 203279)
return seed
title_markdown = ("""
<div style='display: flex; align-items: center; justify-content: center; text-align: center;'>
<img src='https://www.pnglog.com/AOuPMh.png' style='width: 400px; height: auto; margin-right: 10px;' />
</div>
""")
DESCRIPTION = """
# Open-Sora-Plan v1.1.0
## If Open-Sora-Plan is helpful, please help to ✨ the [Github Repo](https://github.com/PKU-YuanGroup/Open-Sora-Plan) and recommend it to your friends 😊
#### [Open-Sora-Plan v1.1.0](https://github.com/PKU-YuanGroup/Open-Sora-Plan) is a transformer-based text-to-video diffusion system trained on text embeddings from T5.
#### This demo is only trained on 3k hours videos, when creating videos, please be aware that it has the potential to generate harmful videos. For more details read our [report]().
#### Image generation is typically 50 steps, video generation maybe 150 steps will yield good results, but this may take 3-4 minutes.
#### Feel free to enjoy the examples.
#### English prompts ONLY; 提示词仅限英文
####
"""
# <br>
# <div align="center">
# <div style="display:flex; gap: 0.25rem;" align="center">
# <a href='https://github.com/PKU-YuanGroup/Open-Sora-Plan'><img src='https://img.shields.io/badge/Github-Code-blue'></a>
# <a href='https://github.com/PKU-YuanGroup/Open-Sora-Plan/stargazers'><img src='https://img.shields.io/github/stars/PKU-YuanGroup/Open-Sora-Plan.svg?style=social'></a>
# </div>
# </div>
# """)
block_css = """
#buttons button {
min-width: min(120px,100%);
}
"""
with open('examples/65.txt', 'r') as f:
examples_txt = f.readlines()
examples_txt = [i.strip() for i in examples_txt]
examples = [[i, 50, 7.5] for i in examples_txt]