Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,7 +63,7 @@ def load_file(file_name):
|
|
| 63 |
content = file.read()
|
| 64 |
return content
|
| 65 |
|
| 66 |
-
def
|
| 67 |
st.title("โถ๏ธ Memory Flag System")
|
| 68 |
|
| 69 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
|
@@ -372,6 +372,7 @@ def create_zip_of_files(files): # ----------------------------------
|
|
| 372 |
for file in files:
|
| 373 |
zipf.write(file)
|
| 374 |
return zip_name
|
|
|
|
| 375 |
@st.cache_resource
|
| 376 |
def get_zip_download_link(zip_file):
|
| 377 |
with open(zip_file, 'rb') as f:
|
|
@@ -380,7 +381,6 @@ def get_zip_download_link(zip_file):
|
|
| 380 |
href = f'<a href="data:application/zip;base64,{b64}" download="{zip_file}">Download All</a>'
|
| 381 |
return href # ----------------------------------
|
| 382 |
|
| 383 |
-
|
| 384 |
def FileSidebar():
|
| 385 |
# ----------------------------------------------------- File Sidebar for Jump Gates ------------------------------------------
|
| 386 |
# Compose a file sidebar of markdown md files:
|
|
@@ -471,6 +471,7 @@ def get_image_as_base64(url):
|
|
| 471 |
return base64.b64encode(response.content).decode("utf-8")
|
| 472 |
else:
|
| 473 |
return None
|
|
|
|
| 474 |
def create_download_link(filename, base64_str):
|
| 475 |
href = f'<a href="data:file/png;base64,{base64_str}" download="{filename}">Download Image</a>'
|
| 476 |
return href
|
|
@@ -479,6 +480,7 @@ image_urls = [
|
|
| 479 |
"https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/2YsnDyc_nDNW71PPKozdN.png",
|
| 480 |
"https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/G_GkRD_IT3f14K7gWlbwi.png",
|
| 481 |
]
|
|
|
|
| 482 |
selected_image_url = random.choice(image_urls)
|
| 483 |
selected_image_base64 = get_image_as_base64(selected_image_url)
|
| 484 |
if selected_image_base64 is not None:
|
|
@@ -487,6 +489,7 @@ if selected_image_base64 is not None:
|
|
| 487 |
st.markdown(f"")
|
| 488 |
else:
|
| 489 |
st.sidebar.write("Failed to load the image.")
|
|
|
|
| 490 |
# ---- Art Card Sidebar with random selection of image.
|
| 491 |
|
| 492 |
|
|
@@ -609,6 +612,19 @@ Example: letter_queue = deque(random.sample(string.ascii_uppercase, 10))"""
|
|
| 609 |
all = query + ' ' + response
|
| 610 |
st.write('๐Run 1 is Complete.')
|
| 611 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 612 |
# ๐Run 2 - Specification Expert - Write a Document to Specify Inner Dialog of Expert
|
| 613 |
specquery = 'For the topic of: ' + query + ', Write a specification which documents your inner dialog as an expert storyteller and word game creator.'
|
| 614 |
specquery = specquery + 'For each one of the Game Features of the specification write three short fun game rules with a plan and description on how to play. Write each like a specification and a story and a game blending fun and humorous ideas which allow a player to get better at all modalities of language.'
|
|
@@ -1252,7 +1268,7 @@ def arxivmain(query):
|
|
| 1252 |
prompt = query
|
| 1253 |
with st.expander("Prompts ๐", expanded=True):
|
| 1254 |
|
| 1255 |
-
|
| 1256 |
|
| 1257 |
example_input = st.text_input("Enter your prompt text:", value=prompt, help="Enter text to get a response.")
|
| 1258 |
if st.button("Run Prompt", help="Click to run."):
|
|
@@ -1380,7 +1396,9 @@ if GiveFeedback:
|
|
| 1380 |
try:
|
| 1381 |
query_params = st.query_params
|
| 1382 |
query = (query_params.get('q') or query_params.get('query') or [''])
|
| 1383 |
-
if query:
|
|
|
|
|
|
|
| 1384 |
except:
|
| 1385 |
st.markdown(' ')
|
| 1386 |
|
|
|
|
| 63 |
content = file.read()
|
| 64 |
return content
|
| 65 |
|
| 66 |
+
def search_arxiv(query):
|
| 67 |
st.title("โถ๏ธ Memory Flag System")
|
| 68 |
|
| 69 |
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
|
|
|
| 372 |
for file in files:
|
| 373 |
zipf.write(file)
|
| 374 |
return zip_name
|
| 375 |
+
|
| 376 |
@st.cache_resource
|
| 377 |
def get_zip_download_link(zip_file):
|
| 378 |
with open(zip_file, 'rb') as f:
|
|
|
|
| 381 |
href = f'<a href="data:application/zip;base64,{b64}" download="{zip_file}">Download All</a>'
|
| 382 |
return href # ----------------------------------
|
| 383 |
|
|
|
|
| 384 |
def FileSidebar():
|
| 385 |
# ----------------------------------------------------- File Sidebar for Jump Gates ------------------------------------------
|
| 386 |
# Compose a file sidebar of markdown md files:
|
|
|
|
| 471 |
return base64.b64encode(response.content).decode("utf-8")
|
| 472 |
else:
|
| 473 |
return None
|
| 474 |
+
|
| 475 |
def create_download_link(filename, base64_str):
|
| 476 |
href = f'<a href="data:file/png;base64,{base64_str}" download="{filename}">Download Image</a>'
|
| 477 |
return href
|
|
|
|
| 480 |
"https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/2YsnDyc_nDNW71PPKozdN.png",
|
| 481 |
"https://cdn-uploads.huggingface.co/production/uploads/620630b603825909dcbeba35/G_GkRD_IT3f14K7gWlbwi.png",
|
| 482 |
]
|
| 483 |
+
|
| 484 |
selected_image_url = random.choice(image_urls)
|
| 485 |
selected_image_base64 = get_image_as_base64(selected_image_url)
|
| 486 |
if selected_image_base64 is not None:
|
|
|
|
| 489 |
st.markdown(f"")
|
| 490 |
else:
|
| 491 |
st.sidebar.write("Failed to load the image.")
|
| 492 |
+
|
| 493 |
# ---- Art Card Sidebar with random selection of image.
|
| 494 |
|
| 495 |
|
|
|
|
| 612 |
all = query + ' ' + response
|
| 613 |
st.write('๐Run 1 is Complete.')
|
| 614 |
|
| 615 |
+
|
| 616 |
+
# ------------------------------- land call to new guy here! --------------------------------------
|
| 617 |
+
|
| 618 |
+
# New guys laughs
|
| 619 |
+
|
| 620 |
+
|
| 621 |
+
|
| 622 |
+
# ------------------------------------------------------------------------------------Thx----------
|
| 623 |
+
|
| 624 |
+
|
| 625 |
+
|
| 626 |
+
|
| 627 |
+
|
| 628 |
# ๐Run 2 - Specification Expert - Write a Document to Specify Inner Dialog of Expert
|
| 629 |
specquery = 'For the topic of: ' + query + ', Write a specification which documents your inner dialog as an expert storyteller and word game creator.'
|
| 630 |
specquery = specquery + 'For each one of the Game Features of the specification write three short fun game rules with a plan and description on how to play. Write each like a specification and a story and a game blending fun and humorous ideas which allow a player to get better at all modalities of language.'
|
|
|
|
| 1268 |
prompt = query
|
| 1269 |
with st.expander("Prompts ๐", expanded=True):
|
| 1270 |
|
| 1271 |
+
search_arxiv(query)
|
| 1272 |
|
| 1273 |
example_input = st.text_input("Enter your prompt text:", value=prompt, help="Enter text to get a response.")
|
| 1274 |
if st.button("Run Prompt", help="Click to run."):
|
|
|
|
| 1396 |
try:
|
| 1397 |
query_params = st.query_params
|
| 1398 |
query = (query_params.get('q') or query_params.get('query') or [''])
|
| 1399 |
+
if query:
|
| 1400 |
+
search_glossary(query)
|
| 1401 |
+
search_arxiv(query)
|
| 1402 |
except:
|
| 1403 |
st.markdown(' ')
|
| 1404 |
|