Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1284,14 +1284,6 @@ def whisper_main():
|
|
| 1284 |
|
| 1285 |
|
| 1286 |
|
| 1287 |
-
# Sample function to demonstrate a response, replace with your own logic
|
| 1288 |
-
def StreamMedChatResponse(topic):
|
| 1289 |
-
st.write(f"Showing resources or questions related to: {topic}")
|
| 1290 |
-
|
| 1291 |
-
|
| 1292 |
-
|
| 1293 |
-
# 17. Main
|
| 1294 |
-
def arxivmain():
|
| 1295 |
|
| 1296 |
prompt = '''
|
| 1297 |
What is MoE?
|
|
@@ -1386,7 +1378,12 @@ What is SORA?
|
|
| 1386 |
st.write(response)
|
| 1387 |
filename = generate_filename(user_prompt, choice)
|
| 1388 |
create_file(filename, user_prompt, response, should_save)
|
| 1389 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1390 |
|
| 1391 |
# Function to encode file to base64
|
| 1392 |
def get_base64_encoded_file(file_path):
|
|
@@ -1454,29 +1451,15 @@ if GiveFeedback:
|
|
| 1454 |
filename = generate_filename(raw, 'txt')
|
| 1455 |
create_file(filename, raw, '', should_save)
|
| 1456 |
|
| 1457 |
-
|
| 1458 |
try:
|
| 1459 |
query_params = st.query_params
|
| 1460 |
query = (query_params.get('q') or query_params.get('query') or [''])
|
| 1461 |
if query:
|
| 1462 |
result = search_arxiv(query)
|
| 1463 |
-
result2 = search_glossary(result)
|
| 1464 |
-
|
| 1465 |
-
|
| 1466 |
-
|
| 1467 |
-
|
| 1468 |
except:
|
| 1469 |
st.markdown(' ')
|
| 1470 |
|
| 1471 |
-
# Display the glossary grid
|
| 1472 |
-
st.markdown("### ๐ฒ๐บ๏ธ Arxiv Paper Search QA RAG MAS using Streamlit and Gradio API")
|
| 1473 |
-
arxivmain()
|
| 1474 |
-
display_videos_and_links() # Video Jump Grid
|
| 1475 |
-
display_images_and_wikipedia_summaries() # Image Jump Grid
|
| 1476 |
-
display_glossary_grid(roleplaying_glossary) # Word Glossary Jump Grid
|
| 1477 |
-
#display_buttons_with_scores() # Feedback Jump Grid
|
| 1478 |
-
|
| 1479 |
-
|
| 1480 |
if 'action' in st.query_params:
|
| 1481 |
action = st.query_params()['action'][0] # Get the first (or only) 'action' parameter
|
| 1482 |
if action == 'show_message':
|
|
@@ -1486,12 +1469,12 @@ if 'action' in st.query_params:
|
|
| 1486 |
st.experimental_rerun()
|
| 1487 |
|
| 1488 |
# Handling repeated keys
|
| 1489 |
-
if 'multi' in st.query_params:
|
| 1490 |
-
multi_values = get_all_query_params('multi')
|
| 1491 |
-
st.write("Values for 'multi':", multi_values)
|
| 1492 |
|
| 1493 |
# Manual entry for demonstration
|
| 1494 |
-
st.write("Enter query parameters in the URL like this: ?action=show_message&multi=1&multi=2")
|
| 1495 |
|
| 1496 |
if 'query' in st.query_params:
|
| 1497 |
query = st.query_params['query'][0] # Get the query parameter
|
|
@@ -1506,4 +1489,10 @@ if st.button("Clear Query Parameters", key='ClearQueryParams'):
|
|
| 1506 |
|
| 1507 |
# 18. Run AI Pipeline
|
| 1508 |
if __name__ == "__main__":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1509 |
whisper_main()
|
|
|
|
| 1284 |
|
| 1285 |
|
| 1286 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1287 |
|
| 1288 |
prompt = '''
|
| 1289 |
What is MoE?
|
|
|
|
| 1378 |
st.write(response)
|
| 1379 |
filename = generate_filename(user_prompt, choice)
|
| 1380 |
create_file(filename, user_prompt, response, should_save)
|
| 1381 |
+
|
| 1382 |
+
|
| 1383 |
+
|
| 1384 |
+
# Sample function to demonstrate a response, replace with your own logic
|
| 1385 |
+
def StreamMedChatResponse(topic):
|
| 1386 |
+
st.write(f"Showing resources or questions related to: {topic}")
|
| 1387 |
|
| 1388 |
# Function to encode file to base64
|
| 1389 |
def get_base64_encoded_file(file_path):
|
|
|
|
| 1451 |
filename = generate_filename(raw, 'txt')
|
| 1452 |
create_file(filename, raw, '', should_save)
|
| 1453 |
|
|
|
|
| 1454 |
try:
|
| 1455 |
query_params = st.query_params
|
| 1456 |
query = (query_params.get('q') or query_params.get('query') or [''])
|
| 1457 |
if query:
|
| 1458 |
result = search_arxiv(query)
|
| 1459 |
+
result2 = search_glossary(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1460 |
except:
|
| 1461 |
st.markdown(' ')
|
| 1462 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1463 |
if 'action' in st.query_params:
|
| 1464 |
action = st.query_params()['action'][0] # Get the first (or only) 'action' parameter
|
| 1465 |
if action == 'show_message':
|
|
|
|
| 1469 |
st.experimental_rerun()
|
| 1470 |
|
| 1471 |
# Handling repeated keys
|
| 1472 |
+
#if 'multi' in st.query_params:
|
| 1473 |
+
# multi_values = get_all_query_params('multi')
|
| 1474 |
+
# st.write("Values for 'multi':", multi_values)
|
| 1475 |
|
| 1476 |
# Manual entry for demonstration
|
| 1477 |
+
#st.write("Enter query parameters in the URL like this: ?action=show_message&multi=1&multi=2")
|
| 1478 |
|
| 1479 |
if 'query' in st.query_params:
|
| 1480 |
query = st.query_params['query'][0] # Get the query parameter
|
|
|
|
| 1489 |
|
| 1490 |
# 18. Run AI Pipeline
|
| 1491 |
if __name__ == "__main__":
|
| 1492 |
+
# Display the glossary grid
|
| 1493 |
+
st.markdown("### ๐ฒ๐บ๏ธ Arxiv Paper Search QA RAG MAS using Streamlit and Gradio API")
|
| 1494 |
+
display_videos_and_links() # Video Jump Grid
|
| 1495 |
+
display_images_and_wikipedia_summaries() # Image Jump Grid
|
| 1496 |
+
display_glossary_grid(roleplaying_glossary) # Word Glossary Jump Grid
|
| 1497 |
+
#display_buttons_with_scores() # Feedback Jump Grid
|
| 1498 |
whisper_main()
|