Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -505,44 +505,42 @@ def perform_ai_lookup(q, vocal_summary=True, extended_refs=False,
|
|
| 505 |
md_file, audio_file = save_qa_with_audio(q, result)
|
| 506 |
st.subheader("📝 Main Response Audio")
|
| 507 |
play_and_download_audio(audio_file, st.session_state['audio_format'])
|
| 508 |
-
|
| 509 |
# --- 2) Arxiv RAG
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
|
| 536 |
-
|
| 537 |
-
|
| 538 |
-
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
|
| 543 |
-
|
| 544 |
-
else:
|
| 545 |
-
st.warning("No papers found in the response.")
|
| 546 |
|
| 547 |
elapsed = time.time() - start
|
| 548 |
st.write(f"**Total Elapsed:** {elapsed:.2f} s")
|
|
|
|
| 505 |
md_file, audio_file = save_qa_with_audio(q, result)
|
| 506 |
st.subheader("📝 Main Response Audio")
|
| 507 |
play_and_download_audio(audio_file, st.session_state['audio_format'])
|
| 508 |
+
|
| 509 |
# --- 2) Arxiv RAG
|
| 510 |
+
searchRAG=False
|
| 511 |
+
if searchRAG:
|
| 512 |
+
st.write("Arxiv's AI this Evening is Mixtral 8x7B...")
|
| 513 |
+
client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
|
| 514 |
+
refs = client.predict(
|
| 515 |
+
q,
|
| 516 |
+
10,
|
| 517 |
+
"Semantic Search",
|
| 518 |
+
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
| 519 |
+
api_name="/update_with_rag_md"
|
| 520 |
+
)[0]
|
| 521 |
+
r2 = client.predict(
|
| 522 |
+
q,
|
| 523 |
+
"mistralai/Mixtral-8x7B-Instruct-v0.1",
|
| 524 |
+
True,
|
| 525 |
+
api_name="/ask_llm"
|
| 526 |
+
)
|
| 527 |
+
result = f"### 🔎 {q}\n\n{r2}\n\n{refs}"
|
| 528 |
+
md_file, audio_file = save_qa_with_audio(q, result)
|
| 529 |
+
|
| 530 |
+
# --- 3) Parse + handle papers
|
| 531 |
+
papers = parse_arxiv_refs(refs)
|
| 532 |
+
if papers:
|
| 533 |
+
# Create minimal links page first
|
| 534 |
+
paper_links = create_paper_links_md(papers)
|
| 535 |
+
links_file = create_file(q, paper_links, "md")
|
| 536 |
+
st.markdown(paper_links)
|
| 537 |
+
|
| 538 |
+
# Then create audio for each paper
|
| 539 |
+
create_paper_audio_files(papers, input_question=q)
|
| 540 |
+
display_papers(papers, get_marquee_settings())
|
| 541 |
+
display_papers_in_sidebar(papers)
|
| 542 |
+
else:
|
| 543 |
+
st.warning("No papers found in the response.")
|
|
|
|
|
|
|
| 544 |
|
| 545 |
elapsed = time.time() - start
|
| 546 |
st.write(f"**Total Elapsed:** {elapsed:.2f} s")
|