YANGYYYY commited on
Commit
ab3d80a
1 Parent(s): 931c498

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -55,7 +55,7 @@ def transfer(image, transfer_style):
55
  return image
56
 
57
 
58
- def transfer_video(video_input, transfer_style,video_output):
59
  if transfer_style == "Hayao":
60
  #output = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)# 转换为灰度图像
61
  #os.system("wget https://huggingface.co/YANGYYYY/cartoonize/resolve/main/GeneratorV2_train_photo_Hayao_init.pt")
@@ -76,9 +76,9 @@ def transfer_video(video_input, transfer_style,video_output):
76
  # # 关闭视频文件
77
  # cap.release()
78
  args.src = video_input
79
- args.out = video_output
80
  Predictor(args.weight).transform_video(args.src, args.out, args.batch_size, start=args.start, end=args.end)
81
-
82
  #anime_video = Predictor(args.weight).transform_video(video, args.batch_size, args.start, args.end)
83
  #return anime_video
84
  elif transfer_style == "Shinkai":
@@ -120,7 +120,7 @@ with gr.Blocks() as demo:
120
  clear_video_button = gr.Button("Clear")
121
 
122
  image_button.click(transfer, inputs=[image_input,image_dropdown], outputs=image_output)
123
- video_button.click(transfer_video, inputs=[video_input,video_dropdown,outputs],outputs=video_output)
124
  clear_image_button.click(clear_output, inputs=image_input,outputs=image_output)
125
  clear_video_button.click(clear_output, inputs=video_input,outputs=video_output)
126
  demo.launch()
 
55
  return image
56
 
57
 
58
+ def transfer_video(video_input, transfer_style):
59
  if transfer_style == "Hayao":
60
  #output = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)# 转换为灰度图像
61
  #os.system("wget https://huggingface.co/YANGYYYY/cartoonize/resolve/main/GeneratorV2_train_photo_Hayao_init.pt")
 
76
  # # 关闭视频文件
77
  # cap.release()
78
  args.src = video_input
79
+ args.out = "video.mp4"
80
  Predictor(args.weight).transform_video(args.src, args.out, args.batch_size, start=args.start, end=args.end)
81
+ return args.out
82
  #anime_video = Predictor(args.weight).transform_video(video, args.batch_size, args.start, args.end)
83
  #return anime_video
84
  elif transfer_style == "Shinkai":
 
120
  clear_video_button = gr.Button("Clear")
121
 
122
  image_button.click(transfer, inputs=[image_input,image_dropdown], outputs=image_output)
123
+ video_button.click(transfer_video, inputs=[video_input,video_dropdown],outputs=video_output)
124
  clear_image_button.click(clear_output, inputs=image_input,outputs=image_output)
125
  clear_video_button.click(clear_output, inputs=video_input,outputs=video_output)
126
  demo.launch()