Spaces:
Sleeping
Sleeping
bubbliiiing
commited on
Commit
·
2dd5165
1
Parent(s):
77fadb6
fix bug in gradio edition
Browse files- easyanimate/ui/ui.py +12 -2
easyanimate/ui/ui.py
CHANGED
|
@@ -6,6 +6,7 @@ import os
|
|
| 6 |
import random
|
| 7 |
import base64
|
| 8 |
import requests
|
|
|
|
| 9 |
from datetime import datetime
|
| 10 |
from glob import glob
|
| 11 |
|
|
@@ -37,6 +38,9 @@ scheduler_dict = {
|
|
| 37 |
"DDIM": DDIMScheduler,
|
| 38 |
}
|
| 39 |
|
|
|
|
|
|
|
|
|
|
| 40 |
css = """
|
| 41 |
.toolbutton {
|
| 42 |
margin-buttom: 0em 0em 0em 0em;
|
|
@@ -726,12 +730,18 @@ class EasyAnimateController_EAS:
|
|
| 726 |
save_sample_path = os.path.join(self.savedir_sample, prefix + f".png")
|
| 727 |
with open(save_sample_path, "wb") as file:
|
| 728 |
file.write(decoded_data)
|
| 729 |
-
|
|
|
|
|
|
|
|
|
|
| 730 |
else:
|
| 731 |
save_sample_path = os.path.join(self.savedir_sample, prefix + f".mp4")
|
| 732 |
with open(save_sample_path, "wb") as file:
|
| 733 |
file.write(decoded_data)
|
| 734 |
-
|
|
|
|
|
|
|
|
|
|
| 735 |
|
| 736 |
|
| 737 |
def ui_eas(edition, config_path, model_name, savedir_sample):
|
|
|
|
| 6 |
import random
|
| 7 |
import base64
|
| 8 |
import requests
|
| 9 |
+
import pkg_resources
|
| 10 |
from datetime import datetime
|
| 11 |
from glob import glob
|
| 12 |
|
|
|
|
| 38 |
"DDIM": DDIMScheduler,
|
| 39 |
}
|
| 40 |
|
| 41 |
+
gradio_version = pkg_resources.get_distribution("gradio").version
|
| 42 |
+
gradio_version_is_above_4 = True if int(gradio_version.split('.')[0]) >= 4 else False
|
| 43 |
+
|
| 44 |
css = """
|
| 45 |
.toolbutton {
|
| 46 |
margin-buttom: 0em 0em 0em 0em;
|
|
|
|
| 730 |
save_sample_path = os.path.join(self.savedir_sample, prefix + f".png")
|
| 731 |
with open(save_sample_path, "wb") as file:
|
| 732 |
file.write(decoded_data)
|
| 733 |
+
if gradio_version_is_above_4:
|
| 734 |
+
return gr.Image(value=save_sample_path, visible=True), gr.Video(value=None, visible=False), "Success"
|
| 735 |
+
else:
|
| 736 |
+
return gr.Image.update(value=save_sample_path, visible=True), gr.Video.update(value=None, visible=False), "Success"
|
| 737 |
else:
|
| 738 |
save_sample_path = os.path.join(self.savedir_sample, prefix + f".mp4")
|
| 739 |
with open(save_sample_path, "wb") as file:
|
| 740 |
file.write(decoded_data)
|
| 741 |
+
if gradio_version_is_above_4:
|
| 742 |
+
return gr.Image(visible=False, value=None), gr.Video(value=save_sample_path, visible=True), "Success"
|
| 743 |
+
else:
|
| 744 |
+
return gr.Image.update(visible=False, value=None), gr.Video.update(value=save_sample_path, visible=True), "Success"
|
| 745 |
|
| 746 |
|
| 747 |
def ui_eas(edition, config_path, model_name, savedir_sample):
|