Skip to content

Commit

Permalink
[CLEANUP]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye committed Apr 16, 2024
1 parent 2081f52 commit 7df5a69
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions servers/text_to_video/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
EulerDiscreteScheduler,
MotionAdapter,
)
from diffusers.utils import export_to_gif
from diffusers.utils import export_to_gif, export_to_video
from dotenv import load_dotenv
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
Expand Down Expand Up @@ -60,29 +60,29 @@ def text_to_video(
beta_schedule="linear",
)

# outputs = []
# for i in range(n):
# output = pipe(
# prompt=task,
# guidance_scale=guidance_scale,
# num_inference_steps=inference_steps,
# )
# outputs.append(output)
# if output_type == ".gif":
# out = export_to_gif([output], f"{output_path}_{i}.gif")
# else:
# out = export_to_video([output], f"{output_path}_{i}.mp4")
output = pipe(
prompt = task,
guidance_scale = guidance_scale,
num_inference_steps = inference_steps
)
output = export_to_gif(output.frames[0], output_path)
return output
outputs = []
for i in range(n):
output = pipe(
prompt=task,
guidance_scale=guidance_scale,
num_inference_steps=inference_steps,
)
outputs.append(output)
if output_type == ".gif":
out = export_to_gif([output], f"{output_path}_{i}.gif")
else:
out = export_to_video([output], f"{output_path}_{i}.mp4")
# output = pipe(
# prompt = task,
# guidance_scale = guidance_scale,
# num_inference_steps = inference_steps
# )
# output = export_to_gif(output.frames[0], output_path)
return out
except Exception as e:
logger.error(f"Error: {e}")
return None


out = text_to_video(task="A girl in hijab studying in a library")
out = text_to_video(task="A girl in hijab studying in a library", n=5)
print(out)

0 comments on commit 7df5a69

Please sign in to comment.