Update app.py
Browse files
app.py
CHANGED
@@ -1800,18 +1800,19 @@ if AddAFileForContext:
|
|
1800 |
|
1801 |
|
1802 |
def main():
|
1803 |
-
#st.markdown("### OpenAI GPT-4o Model")
|
1804 |
st.markdown("##### GPT-4o Omni Model: Text, Audio, Image, & Video")
|
1805 |
option = st.selectbox("Select an option", ("Text", "Image", "Audio", "Video"))
|
1806 |
if option == "Text":
|
1807 |
text_input = st.text_input("Enter your text:")
|
1808 |
if (text_input > ''):
|
1809 |
textResponse = process_text(text_input)
|
|
|
1810 |
elif option == "Image":
|
1811 |
text = "Help me understand what is in this picture and list ten facts as markdown outline with appropriate emojis that describes what you see."
|
1812 |
text_input = st.text_input(label="Enter text prompt to use with Image context.", value=text)
|
1813 |
image_input = st.file_uploader("Upload an image", type=["png"])
|
1814 |
-
|
|
|
1815 |
|
1816 |
elif option == "Audio":
|
1817 |
text = "You are generating a transcript summary. Create a summary of the provided transcription. Respond in Markdown."
|
@@ -1824,7 +1825,6 @@ def main():
|
|
1824 |
process_audio(audio_input, text_input)
|
1825 |
|
1826 |
elif option == "Audio old":
|
1827 |
-
#text = "Transcribe and answer questions as a helpful audio music and speech assistant. "
|
1828 |
text = "You are generating a transcript summary. Create a summary of the provided transcription. Respond in Markdown."
|
1829 |
text_input = st.text_input(label="Enter text prompt to use with Audio context.", value=text)
|
1830 |
|
@@ -1851,7 +1851,6 @@ def main():
|
|
1851 |
video_input = st.file_uploader("Upload a video file", type=["mp4"])
|
1852 |
process_audio_and_video(video_input)
|
1853 |
|
1854 |
-
|
1855 |
# Enter the GPT-4o omni model in streamlit chatbot
|
1856 |
current_messages=[]
|
1857 |
for message in st.session_state.messages:
|
@@ -1859,8 +1858,6 @@ for message in st.session_state.messages:
|
|
1859 |
current_messages.append(message)
|
1860 |
st.markdown(message["content"])
|
1861 |
|
1862 |
-
|
1863 |
-
|
1864 |
# 🎵 Wav Audio files - Transcription History in Wav
|
1865 |
audio_files = glob.glob("*.wav")
|
1866 |
audio_files = [file for file in audio_files if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
@@ -1881,9 +1878,6 @@ video_files_mp3 = glob.glob("*.mp3")
|
|
1881 |
video_files_mp3 = [file for file in video_files_mp3 if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1882 |
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
|
1883 |
|
1884 |
-
|
1885 |
-
|
1886 |
-
|
1887 |
main()
|
1888 |
|
1889 |
# Delete All button for each file type
|
@@ -1962,10 +1956,6 @@ for file in video_files_mp3:
|
|
1962 |
os.remove(file)
|
1963 |
st.rerun()
|
1964 |
|
1965 |
-
|
1966 |
-
|
1967 |
-
|
1968 |
-
|
1969 |
# ChatBot Entry
|
1970 |
if prompt := st.chat_input("GPT-4o Multimodal ChatBot - What can I help you with?"):
|
1971 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
@@ -1980,10 +1970,6 @@ if prompt := st.chat_input("GPT-4o Multimodal ChatBot - What can I help you with
|
|
1980 |
response = process_text2(text_input=prompt)
|
1981 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
1982 |
|
1983 |
-
|
1984 |
-
|
1985 |
-
|
1986 |
-
|
1987 |
# Image and Video Galleries
|
1988 |
num_columns_images=st.slider(key="num_columns_images", label="Choose Number of Image Columns", min_value=1, max_value=15, value=3)
|
1989 |
display_images_and_wikipedia_summaries(num_columns_images) # Image Jump Grid
|
@@ -1991,7 +1977,6 @@ display_images_and_wikipedia_summaries(num_columns_images) # Image Jump Grid
|
|
1991 |
num_columns_video=st.slider(key="num_columns_video", label="Choose Number of Video Columns", min_value=1, max_value=15, value=3)
|
1992 |
display_videos_and_links(num_columns_video) # Video Jump Grid
|
1993 |
|
1994 |
-
|
1995 |
# Optional UI's
|
1996 |
showExtendedTextInterface=False
|
1997 |
if showExtendedTextInterface:
|
@@ -1999,9 +1984,3 @@ if showExtendedTextInterface:
|
|
1999 |
num_columns_text=st.slider(key="num_columns_text", label="Choose Number of Text Columns", min_value=1, max_value=15, value=4)
|
2000 |
display_buttons_with_scores(num_columns_text) # Feedback Jump Grid
|
2001 |
st.markdown(personality_factors)
|
2002 |
-
|
2003 |
-
|
2004 |
-
|
2005 |
-
|
2006 |
-
#if __name__ == "__main__":
|
2007 |
-
|
|
|
1800 |
|
1801 |
|
1802 |
def main():
|
|
|
1803 |
st.markdown("##### GPT-4o Omni Model: Text, Audio, Image, & Video")
|
1804 |
option = st.selectbox("Select an option", ("Text", "Image", "Audio", "Video"))
|
1805 |
if option == "Text":
|
1806 |
text_input = st.text_input("Enter your text:")
|
1807 |
if (text_input > ''):
|
1808 |
textResponse = process_text(text_input)
|
1809 |
+
|
1810 |
elif option == "Image":
|
1811 |
text = "Help me understand what is in this picture and list ten facts as markdown outline with appropriate emojis that describes what you see."
|
1812 |
text_input = st.text_input(label="Enter text prompt to use with Image context.", value=text)
|
1813 |
image_input = st.file_uploader("Upload an image", type=["png"])
|
1814 |
+
if (image_input is not None):
|
1815 |
+
image_response = process_image(image_input, text_input)
|
1816 |
|
1817 |
elif option == "Audio":
|
1818 |
text = "You are generating a transcript summary. Create a summary of the provided transcription. Respond in Markdown."
|
|
|
1825 |
process_audio(audio_input, text_input)
|
1826 |
|
1827 |
elif option == "Audio old":
|
|
|
1828 |
text = "You are generating a transcript summary. Create a summary of the provided transcription. Respond in Markdown."
|
1829 |
text_input = st.text_input(label="Enter text prompt to use with Audio context.", value=text)
|
1830 |
|
|
|
1851 |
video_input = st.file_uploader("Upload a video file", type=["mp4"])
|
1852 |
process_audio_and_video(video_input)
|
1853 |
|
|
|
1854 |
# Enter the GPT-4o omni model in streamlit chatbot
|
1855 |
current_messages=[]
|
1856 |
for message in st.session_state.messages:
|
|
|
1858 |
current_messages.append(message)
|
1859 |
st.markdown(message["content"])
|
1860 |
|
|
|
|
|
1861 |
# 🎵 Wav Audio files - Transcription History in Wav
|
1862 |
audio_files = glob.glob("*.wav")
|
1863 |
audio_files = [file for file in audio_files if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
|
|
1878 |
video_files_mp3 = [file for file in video_files_mp3 if len(os.path.splitext(file)[0]) >= 10] # exclude files with short names
|
1879 |
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
|
1880 |
|
|
|
|
|
|
|
1881 |
main()
|
1882 |
|
1883 |
# Delete All button for each file type
|
|
|
1956 |
os.remove(file)
|
1957 |
st.rerun()
|
1958 |
|
|
|
|
|
|
|
|
|
1959 |
# ChatBot Entry
|
1960 |
if prompt := st.chat_input("GPT-4o Multimodal ChatBot - What can I help you with?"):
|
1961 |
st.session_state.messages.append({"role": "user", "content": prompt})
|
|
|
1970 |
response = process_text2(text_input=prompt)
|
1971 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
1972 |
|
|
|
|
|
|
|
|
|
1973 |
# Image and Video Galleries
|
1974 |
num_columns_images=st.slider(key="num_columns_images", label="Choose Number of Image Columns", min_value=1, max_value=15, value=3)
|
1975 |
display_images_and_wikipedia_summaries(num_columns_images) # Image Jump Grid
|
|
|
1977 |
num_columns_video=st.slider(key="num_columns_video", label="Choose Number of Video Columns", min_value=1, max_value=15, value=3)
|
1978 |
display_videos_and_links(num_columns_video) # Video Jump Grid
|
1979 |
|
|
|
1980 |
# Optional UI's
|
1981 |
showExtendedTextInterface=False
|
1982 |
if showExtendedTextInterface:
|
|
|
1984 |
num_columns_text=st.slider(key="num_columns_text", label="Choose Number of Text Columns", min_value=1, max_value=15, value=4)
|
1985 |
display_buttons_with_scores(num_columns_text) # Feedback Jump Grid
|
1986 |
st.markdown(personality_factors)
|
|
|
|
|
|
|
|
|
|
|
|