Spaces:
Running
Running
Ruslan Magana Vsevolodovna
commited on
Commit
·
1708b8b
1
Parent(s):
bb065e6
Update app.py
Browse files
app.py
CHANGED
|
@@ -43,6 +43,13 @@ def get_output_video(text):
|
|
| 43 |
clean_up_tokenization_spaces=False)
|
| 44 |
plot = list(summary[0].split('.'))
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
def generate_image(
|
| 47 |
is_mega: bool,
|
| 48 |
text: str,
|
|
@@ -58,7 +65,8 @@ def get_output_video(text):
|
|
| 58 |
is_reusable=False,
|
| 59 |
is_verbose=True,
|
| 60 |
#dtype=torch.float16 if fp16 else torch.float32
|
| 61 |
-
dtype=torch.
|
|
|
|
| 62 |
)
|
| 63 |
|
| 64 |
image = model.generate_image(
|
|
@@ -74,7 +82,7 @@ def get_output_video(text):
|
|
| 74 |
generated_images = []
|
| 75 |
for senten in plot[:-1]:
|
| 76 |
image=generate_image(
|
| 77 |
-
is_mega=
|
| 78 |
text=senten,
|
| 79 |
seed=1,
|
| 80 |
grid_size=1,
|
|
|
|
| 43 |
clean_up_tokenization_spaces=False)
|
| 44 |
plot = list(summary[0].split('.'))
|
| 45 |
|
| 46 |
+
'''
|
| 47 |
+
The required models will be downloaded to models_root if they are not already there.
|
| 48 |
+
Set the dtype to torch.float16 to save GPU memory.
|
| 49 |
+
If you have an Ampere architecture GPU you can use torch.bfloat16.
|
| 50 |
+
Set the device to either "cuda" or "cpu". Once everything has finished initializing,
|
| 51 |
+
'''
|
| 52 |
+
|
| 53 |
def generate_image(
|
| 54 |
is_mega: bool,
|
| 55 |
text: str,
|
|
|
|
| 65 |
is_reusable=False,
|
| 66 |
is_verbose=True,
|
| 67 |
#dtype=torch.float16 if fp16 else torch.float32
|
| 68 |
+
dtype=torch.float16,
|
| 69 |
+
device='cuda'
|
| 70 |
)
|
| 71 |
|
| 72 |
image = model.generate_image(
|
|
|
|
| 82 |
generated_images = []
|
| 83 |
for senten in plot[:-1]:
|
| 84 |
image=generate_image(
|
| 85 |
+
is_mega= True,
|
| 86 |
text=senten,
|
| 87 |
seed=1,
|
| 88 |
grid_size=1,
|