Fabrice-TIERCELIN commited on
Commit
690f172
·
verified ·
1 Parent(s): de5e525

Link to model

Browse files
Files changed (1) hide show
  1. gradio_server.py +11 -3
gradio_server.py CHANGED
@@ -56,7 +56,7 @@ def generate_video(
56
  samples = outputs['samples']
57
  sample = samples[0].unsqueeze(0)
58
 
59
- save_path = os.path.join(os.getcwd(), "gradio_outputs")
60
  os.makedirs(save_path, exist_ok=True)
61
 
62
  time_flag = datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d-%H:%M:%S")
@@ -66,10 +66,18 @@ def generate_video(
66
 
67
  return video_path
68
 
69
- def create_demo(model_path, save_path):
70
  model = initialize_model(model_path)
71
 
72
  with gr.Blocks() as demo:
 
 
 
 
 
 
 
 
73
  gr.Markdown("# Hunyuan Video Generation")
74
 
75
  with gr.Row():
@@ -135,5 +143,5 @@ def create_demo(model_path, save_path):
135
 
136
  if __name__ == "__main__":
137
  os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
138
- demo = create_demo(args.model_base, args.save_path)
139
  demo.queue(10).launch()
 
56
  samples = outputs['samples']
57
  sample = samples[0].unsqueeze(0)
58
 
59
+ save_path = "./gradio_outputs"
60
  os.makedirs(save_path, exist_ok=True)
61
 
62
  time_flag = datetime.fromtimestamp(time.time()).strftime("%Y-%m-%d-%H:%M:%S")
 
66
 
67
  return video_path
68
 
69
+ def create_demo(model_path):
70
  model = initialize_model(model_path)
71
 
72
  with gr.Blocks() as demo:
73
+ if torch.cuda.device_count() == 0:
74
+ with gr.Row():
75
+ gr.HTML("""
76
+ <p style="background-color: red;"><big><big><big><b>⚠️To use <i>Hunyuan Video</i>, <a href="https://huggingface.co/spaces/Fabrice-TIERCELIN/HunyuanVideo?duplicate=true">duplicate this space</a> and set a GPU with 80 GB VRAM.</b>
77
+
78
+ You can't use <i>Hunyuan Video</i> directly here because this space runs on a CPU, which is not enough for <i>Hunyuan Video</i>. Please provide <a href="https://huggingface.co/spaces/Fabrice-TIERCELIN/HunyuanVideo/discussions/new">feedback</a> if you have issues.
79
+ </big></big></big></p>
80
+ """)
81
  gr.Markdown("# Hunyuan Video Generation")
82
 
83
  with gr.Row():
 
143
 
144
  if __name__ == "__main__":
145
  os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
146
+ demo = create_demo("tencent/HunyuanVideo")
147
  demo.queue(10).launch()