anurag629 commited on
Commit
9f1a6bb
1 Parent(s): 492235c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -4,7 +4,7 @@ import subprocess
4
  from PIL import Image
5
  from io import BytesIO
6
 
7
- # Function to run the provided script
8
  def run_script(image_path, video_path):
9
  script = """
10
  !git clone https://github.com/s0md3v/roop.git
@@ -18,6 +18,9 @@ def run_script(image_path, video_path):
18
  """.format(video_path, image_path)
19
 
20
  subprocess.run(script, shell=True)
 
 
 
21
 
22
  # Streamlit app
23
  def main():
@@ -40,11 +43,11 @@ def main():
40
  with open(video_path, "wb") as f:
41
  f.write(video_file.read())
42
 
43
- # Run the script
44
- run_script(image_path, video_path)
45
 
46
  # Display the swapped video
47
- video_bytes = open("/content/swapped.mp4", "rb").read()
48
  st.video(video_bytes)
49
 
50
  if __name__ == "__main__":
 
4
  from PIL import Image
5
  from io import BytesIO
6
 
7
+ # Function to run the provided script and return the path of the generated video
8
  def run_script(image_path, video_path):
9
  script = """
10
  !git clone https://github.com/s0md3v/roop.git
 
18
  """.format(video_path, image_path)
19
 
20
  subprocess.run(script, shell=True)
21
+
22
+ # Return the path of the generated video
23
+ return "/content/swapped.mp4"
24
 
25
  # Streamlit app
26
  def main():
 
43
  with open(video_path, "wb") as f:
44
  f.write(video_file.read())
45
 
46
+ # Run the script and get the path of the generated video
47
+ generated_video_path = run_script(image_path, video_path)
48
 
49
  # Display the swapped video
50
+ video_bytes = open(generated_video_path, "rb").read()
51
  st.video(video_bytes)
52
 
53
  if __name__ == "__main__":