Update app.py
Browse files
app.py
CHANGED
@@ -1837,6 +1837,40 @@ if AddAFileForContext:
|
|
1837 |
|
1838 |
|
1839 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1840 |
def main():
|
1841 |
st.markdown("##### GPT-4o Omni Model: Text, Audio, Image, & Video")
|
1842 |
option = st.selectbox("Select an option", ("Text", "Image", "Audio", "Video"))
|
@@ -1892,32 +1926,48 @@ def main():
|
|
1892 |
video_input = st.file_uploader("Upload a video file", type=["mp4"])
|
1893 |
process_audio_and_video(video_input)
|
1894 |
|
1895 |
-
# Enter the GPT-4o omni model in streamlit chatbot
|
1896 |
-
current_messages=[]
|
1897 |
-
for message in st.session_state.messages:
|
1898 |
-
with st.chat_message(message["role"]):
|
1899 |
-
current_messages.append(message)
|
1900 |
-
st.markdown(message["content"])
|
1901 |
|
1902 |
-
|
1903 |
-
|
1904 |
-
|
1905 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1906 |
|
1907 |
-
# 🖼 PNG Image files
|
1908 |
-
image_files = glob.glob("*.png")
|
1909 |
-
image_files = [file for file in image_files if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1910 |
-
image_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
1911 |
|
1912 |
-
# 🎥 MP4 Video files
|
1913 |
-
video_files = glob.glob("*.mp4")
|
1914 |
-
video_files = [file for file in video_files if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1915 |
-
video_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
1916 |
|
1917 |
-
# 🎥 MP3 Video files
|
1918 |
-
video_files_mp3 = glob.glob("*.mp3")
|
1919 |
-
video_files_mp3 = [file for file in video_files_mp3 if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1920 |
-
video_files_mp3.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
1921 |
|
1922 |
main()
|
1923 |
|
@@ -2062,45 +2112,3 @@ def load_component(name, file_type):
|
|
2062 |
except FileNotFoundError:
|
2063 |
return None
|
2064 |
|
2065 |
-
def main():
|
2066 |
-
st.title("AI-Generated Component Manager")
|
2067 |
-
|
2068 |
-
# Run all Python files in the directory
|
2069 |
-
for py_file in recursive_file_search("."):
|
2070 |
-
output = run_py_file(py_file)
|
2071 |
-
if output:
|
2072 |
-
st.write(f"Output from {py_file}:", output)
|
2073 |
-
|
2074 |
-
# Component management
|
2075 |
-
component_type = st.selectbox("Select component type", ["react", "typescript"])
|
2076 |
-
component_name = st.text_input("Component name")
|
2077 |
-
component_content = st.text_area("Component content")
|
2078 |
-
|
2079 |
-
if st.button("Save Component"):
|
2080 |
-
save_component(component_name, component_content, component_type)
|
2081 |
-
st.success(f"Saved {component_type} component: {component_name}")
|
2082 |
-
|
2083 |
-
if st.button("Load Component"):
|
2084 |
-
loaded_content = load_component(component_name, component_type)
|
2085 |
-
if loaded_content:
|
2086 |
-
st.code(loaded_content, language=component_type)
|
2087 |
-
else:
|
2088 |
-
st.error(f"Component {component_name} not found")
|
2089 |
-
|
2090 |
-
# Display components using Streamlit's components
|
2091 |
-
st.components.v1.html(
|
2092 |
-
f"""
|
2093 |
-
<div id="react-root"></div>
|
2094 |
-
<script src="https://unpkg.com/react@17/umd/react.development.js"></script>
|
2095 |
-
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
|
2096 |
-
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
|
2097 |
-
<script type="text/babel">
|
2098 |
-
// Load and render components here
|
2099 |
-
ReactDOM.render(<div>Custom Component</div>, document.getElementById('react-root'));
|
2100 |
-
</script>
|
2101 |
-
""",
|
2102 |
-
height=300,
|
2103 |
-
)
|
2104 |
-
|
2105 |
-
if __name__ == "__main__":
|
2106 |
-
main()
|
|
|
1837 |
|
1838 |
|
1839 |
|
1840 |
+
|
1841 |
+
# Enter the GPT-4o omni model in streamlit chatbot
|
1842 |
+
current_messages=[]
|
1843 |
+
for message in st.session_state.messages:
|
1844 |
+
with st.chat_message(message["role"]):
|
1845 |
+
current_messages.append(message)
|
1846 |
+
st.markdown(message["content"])
|
1847 |
+
|
1848 |
+
# 🎵 Wav Audio files - Transcription History in Wav
|
1849 |
+
audio_files = glob.glob("*.wav")
|
1850 |
+
audio_files = [file for file in audio_files if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1851 |
+
audio_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
1852 |
+
|
1853 |
+
# 🖼 PNG Image files
|
1854 |
+
image_files = glob.glob("*.png")
|
1855 |
+
image_files = [file for file in image_files if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1856 |
+
image_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
1857 |
+
|
1858 |
+
# 🎥 MP4 Video files
|
1859 |
+
video_files = glob.glob("*.mp4")
|
1860 |
+
video_files = [file for file in video_files if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1861 |
+
video_files.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
1862 |
+
|
1863 |
+
# 🎥 MP3 Video files
|
1864 |
+
video_files_mp3 = glob.glob("*.mp3")
|
1865 |
+
video_files_mp3 = [file for file in video_files_mp3 if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1866 |
+
video_files_mp3.sort(key=lambda x: (os.path.splitext(x)[1], x), reverse=True) # sort by file type and file name in descending order
|
1867 |
+
|
1868 |
+
|
1869 |
+
|
1870 |
+
|
1871 |
+
|
1872 |
+
|
1873 |
+
|
1874 |
def main():
|
1875 |
st.markdown("##### GPT-4o Omni Model: Text, Audio, Image, & Video")
|
1876 |
option = st.selectbox("Select an option", ("Text", "Image", "Audio", "Video"))
|
|
|
1926 |
video_input = st.file_uploader("Upload a video file", type=["mp4"])
|
1927 |
process_audio_and_video(video_input)
|
1928 |
|
|
|
|
|
|
|
|
|
|
|
|
|
1929 |
|
1930 |
+
st.title("AI-Generated Component Manager")
|
1931 |
+
|
1932 |
+
# Run all Python files in the directory
|
1933 |
+
for py_file in recursive_file_search("."):
|
1934 |
+
output = run_py_file(py_file)
|
1935 |
+
if output:
|
1936 |
+
st.write(f"Output from {py_file}:", output)
|
1937 |
+
|
1938 |
+
# Component management
|
1939 |
+
component_type = st.selectbox("Select component type", ["react", "typescript"])
|
1940 |
+
component_name = st.text_input("Component name")
|
1941 |
+
component_content = st.text_area("Component content")
|
1942 |
+
|
1943 |
+
if st.button("Save Component"):
|
1944 |
+
save_component(component_name, component_content, component_type)
|
1945 |
+
st.success(f"Saved {component_type} component: {component_name}")
|
1946 |
+
|
1947 |
+
if st.button("Load Component"):
|
1948 |
+
loaded_content = load_component(component_name, component_type)
|
1949 |
+
if loaded_content:
|
1950 |
+
st.code(loaded_content, language=component_type)
|
1951 |
+
else:
|
1952 |
+
st.error(f"Component {component_name} not found")
|
1953 |
+
|
1954 |
+
# Display components using Streamlit's components
|
1955 |
+
st.components.v1.html(
|
1956 |
+
f"""
|
1957 |
+
<div id="react-root"></div>
|
1958 |
+
<script src="https://unpkg.com/react@17/umd/react.development.js"></script>
|
1959 |
+
<script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
|
1960 |
+
<script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
|
1961 |
+
<script type="text/babel">
|
1962 |
+
// Load and render components here
|
1963 |
+
ReactDOM.render(<div>Custom Component</div>, document.getElementById('react-root'));
|
1964 |
+
</script>
|
1965 |
+
""",
|
1966 |
+
height=300,
|
1967 |
+
)
|
1968 |
|
|
|
|
|
|
|
|
|
1969 |
|
|
|
|
|
|
|
|
|
1970 |
|
|
|
|
|
|
|
|
|
1971 |
|
1972 |
main()
|
1973 |
|
|
|
2112 |
except FileNotFoundError:
|
2113 |
return None
|
2114 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|