Pranjal Pruthi commited on
Commit
4a8de42
·
1 Parent(s): 820a885

Add application files and dependencies

Browse files
Files changed (2) hide show
  1. app.py +9 -6
  2. packages.txt +1 -1
app.py CHANGED
@@ -3,8 +3,6 @@ import subprocess
3
  import os
4
  import glob
5
  import shutil
6
- import streamlit as st
7
- import subprocess
8
 
9
  def check_dependencies():
10
  # Check ffmpeg
@@ -33,12 +31,17 @@ def check_dependencies():
33
  # Call this function when your app starts
34
  check_dependencies()
35
 
36
-
37
  def run_command(command):
38
  process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, universal_newlines=True)
39
- output, error = process.communicate()
40
- return output, error
41
-
 
 
 
 
 
 
42
 
43
  def process_video(url):
44
  output_dir = "./output_folder"
 
3
  import os
4
  import glob
5
  import shutil
 
 
6
 
7
  def check_dependencies():
8
  # Check ffmpeg
 
31
  # Call this function when your app starts
32
  check_dependencies()
33
 
 
34
  def run_command(command):
35
  process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, universal_newlines=True)
36
+ output_lines = []
37
+ for line in process.stdout:
38
+ output_lines.append(line)
39
+ if len(output_lines) > 10: # Keep only the last 10 lines
40
+ output_lines.pop(0)
41
+ st.text(''.join(output_lines))
42
+ process.stdout.close()
43
+ process.wait()
44
+ return ''.join(output_lines), process.stderr.read()
45
 
46
  def process_video(url):
47
  output_dir = "./output_folder"
packages.txt CHANGED
@@ -1 +1 @@
1
- ffmpeg
 
1
+ ffmpeg