awacke1 commited on
Commit
d9bd521
·
verified ·
1 Parent(s): 4d06260

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -37
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
- st.write("Arxiv's AI this Evening is Mixtral 8x7B...")
511
- client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
512
- refs = client.predict(
513
- q,
514
- 20,
515
- "Semantic Search",
516
- "mistralai/Mixtral-8x7B-Instruct-v0.1",
517
- api_name="/update_with_rag_md"
518
- )[0]
519
-
520
- r2 = client.predict(
521
- q,
522
- "mistralai/Mixtral-8x7B-Instruct-v0.1",
523
- True,
524
- api_name="/ask_llm"
525
- )
526
-
527
- result = f"### 🔎 {q}\n\n{r2}\n\n{refs}"
528
- md_file, audio_file = save_qa_with_audio(q, result)
529
- st.subheader("📝 Main Response Audio")
530
- play_and_download_audio(audio_file, st.session_state['audio_format'])
531
-
532
- # --- 3) Parse + handle papers
533
- papers = parse_arxiv_refs(refs)
534
- if papers:
535
- # Create minimal links page first
536
- paper_links = create_paper_links_md(papers)
537
- links_file = create_file(q, paper_links, "md")
538
- st.markdown(paper_links)
539
-
540
- # Then create audio for each paper
541
- create_paper_audio_files(papers, input_question=q)
542
- display_papers(papers, get_marquee_settings())
543
- display_papers_in_sidebar(papers)
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")