Update app.py
Browse files
app.py
CHANGED
@@ -286,7 +286,7 @@ roleplaying_glossary = {
|
|
286 |
|
287 |
|
288 |
# This displays per video and per image.
|
289 |
-
|
290 |
def display_glossary_entity(k):
|
291 |
search_urls = {
|
292 |
"๐๐ArXiv": lambda k: f"/?q={quote(k)}", # this url plus query!
|
@@ -445,7 +445,7 @@ def FileSidebar():
|
|
445 |
duplicate_flag = "๐ฉ" if size == previous_size else ""
|
446 |
with st.sidebar.expander(f"File: {file} {duplicate_flag}"):
|
447 |
st.text(f"Size: {size} bytes")
|
448 |
-
|
449 |
if st.button("View", key=f"view_{file}"):
|
450 |
try:
|
451 |
with open(file, "r", encoding='utf-8') as f: # Ensure the file is read with UTF-8 encoding
|
@@ -743,7 +743,7 @@ def display_glossary(glossary, area):
|
|
743 |
|
744 |
|
745 |
|
746 |
-
|
747 |
def display_videos_and_links(num_columns):
|
748 |
video_files = [f for f in os.listdir('.') if f.endswith('.mp4')]
|
749 |
if not video_files:
|
@@ -764,7 +764,7 @@ def display_videos_and_links(num_columns):
|
|
764 |
display_glossary_entity(k)
|
765 |
col_index += 1 # Increment column index to place the next video in the next column
|
766 |
|
767 |
-
|
768 |
def display_images_and_wikipedia_summaries(num_columns=4):
|
769 |
image_files = [f for f in os.listdir('.') if f.endswith('.png')]
|
770 |
if not image_files:
|
@@ -880,7 +880,7 @@ should_save = st.sidebar.checkbox("๐พ Save", value=True, help="Save your sessi
|
|
880 |
|
881 |
|
882 |
# 3. Stream Llama Response
|
883 |
-
|
884 |
def StreamLLMChatResponse(prompt):
|
885 |
try:
|
886 |
endpoint_url = API_URL
|
|
|
286 |
|
287 |
|
288 |
# This displays per video and per image.
|
289 |
+
@st.cache_resource
|
290 |
def display_glossary_entity(k):
|
291 |
search_urls = {
|
292 |
"๐๐ArXiv": lambda k: f"/?q={quote(k)}", # this url plus query!
|
|
|
445 |
duplicate_flag = "๐ฉ" if size == previous_size else ""
|
446 |
with st.sidebar.expander(f"File: {file} {duplicate_flag}"):
|
447 |
st.text(f"Size: {size} bytes")
|
448 |
+
|
449 |
if st.button("View", key=f"view_{file}"):
|
450 |
try:
|
451 |
with open(file, "r", encoding='utf-8') as f: # Ensure the file is read with UTF-8 encoding
|
|
|
743 |
|
744 |
|
745 |
|
746 |
+
@st.cache_resource
|
747 |
def display_videos_and_links(num_columns):
|
748 |
video_files = [f for f in os.listdir('.') if f.endswith('.mp4')]
|
749 |
if not video_files:
|
|
|
764 |
display_glossary_entity(k)
|
765 |
col_index += 1 # Increment column index to place the next video in the next column
|
766 |
|
767 |
+
@st.cache_resource
|
768 |
def display_images_and_wikipedia_summaries(num_columns=4):
|
769 |
image_files = [f for f in os.listdir('.') if f.endswith('.png')]
|
770 |
if not image_files:
|
|
|
880 |
|
881 |
|
882 |
# 3. Stream Llama Response
|
883 |
+
@st.cache_resource
|
884 |
def StreamLLMChatResponse(prompt):
|
885 |
try:
|
886 |
endpoint_url = API_URL
|