awacke1 commited on
Commit
66728c1
ยท
verified ยท
1 Parent(s): b822a78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -34
app.py CHANGED
@@ -13,6 +13,7 @@ import streamlit.components.v1 as components
13
  import textract
14
  import time
15
  import zipfile
 
16
 
17
  from audio_recorder_streamlit import audio_recorder
18
  from bs4 import BeautifulSoup
@@ -1869,6 +1870,37 @@ video_files_mp3.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) #
1869
 
1870
 
1871
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1872
 
1873
 
1874
  def main():
@@ -2078,37 +2110,3 @@ if showExtendedTextInterface:
2078
 
2079
 
2080
 
2081
-
2082
- import streamlit as st
2083
- import os
2084
- import importlib.util
2085
-
2086
- def run_py_file(file_path):
2087
- """๐Ÿƒโ€โ™‚๏ธ Run a Python file and return its output"""
2088
- spec = importlib.util.spec_from_file_location("module.name", file_path)
2089
- module = importlib.util.module_from_spec(spec)
2090
- spec.loader.exec_module(module)
2091
- return getattr(module, 'output', None)
2092
-
2093
- def recursive_file_search(directory):
2094
- """๐Ÿ” Recursively search for .py files in a directory"""
2095
- for root, dirs, files in os.walk(directory):
2096
- for file in files:
2097
- if file.endswith('.py'):
2098
- yield os.path.join(root, file)
2099
-
2100
- def save_component(name, content, file_type):
2101
- """๐Ÿ’พ Save a component to a file"""
2102
- directory = f"components/{file_type}"
2103
- os.makedirs(directory, exist_ok=True)
2104
- with open(f"{directory}/{name}.{file_type}", "w") as f:
2105
- f.write(content)
2106
-
2107
- def load_component(name, file_type):
2108
- """๐Ÿ“‚ Load a component from a file"""
2109
- try:
2110
- with open(f"components/{file_type}/{name}.{file_type}", "r") as f:
2111
- return f.read()
2112
- except FileNotFoundError:
2113
- return None
2114
-
 
13
  import textract
14
  import time
15
  import zipfile
16
+ import importlib.util
17
 
18
  from audio_recorder_streamlit import audio_recorder
19
  from bs4 import BeautifulSoup
 
1870
 
1871
 
1872
 
1873
+ def run_py_file(file_path):
1874
+ """๐Ÿƒโ€โ™‚๏ธ Run a Python file and return its output"""
1875
+ spec = importlib.util.spec_from_file_location("module.name", file_path)
1876
+ module = importlib.util.module_from_spec(spec)
1877
+ spec.loader.exec_module(module)
1878
+ return getattr(module, 'output', None)
1879
+
1880
+ def recursive_file_search(directory):
1881
+ """๐Ÿ” Recursively search for .py files in a directory"""
1882
+ for root, dirs, files in os.walk(directory):
1883
+ for file in files:
1884
+ if file.endswith('.py'):
1885
+ yield os.path.join(root, file)
1886
+
1887
+ def save_component(name, content, file_type):
1888
+ """๐Ÿ’พ Save a component to a file"""
1889
+ directory = f"components/{file_type}"
1890
+ os.makedirs(directory, exist_ok=True)
1891
+ with open(f"{directory}/{name}.{file_type}", "w") as f:
1892
+ f.write(content)
1893
+
1894
+ def load_component(name, file_type):
1895
+ """๐Ÿ“‚ Load a component from a file"""
1896
+ try:
1897
+ with open(f"components/{file_type}/{name}.{file_type}", "r") as f:
1898
+ return f.read()
1899
+ except FileNotFoundError:
1900
+ return None
1901
+
1902
+
1903
+
1904
 
1905
 
1906
  def main():
 
2110
 
2111
 
2112