awacke1 commited on
Commit
db36aba
·
verified ·
1 Parent(s): 36e829f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +46 -41
app.py CHANGED
@@ -499,53 +499,58 @@ def perform_ai_lookup(q, vocal_summary=True, extended_refs=False,
499
  st.write("Claude's reply 🧠:")
500
  st.markdown(response.content[0].text)
501
 
502
- # Save & produce audio
503
  result = response.content[0].text
504
  create_file(q, result)
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")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
549
  return result
550
 
551
  def process_voice_input(text):
 
499
  st.write("Claude's reply 🧠:")
500
  st.markdown(response.content[0].text)
501
 
502
+ # Save & produce audio and text result
503
  result = response.content[0].text
504
  create_file(q, result)
505
  md_file, audio_file = save_qa_with_audio(q, result)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
506
 
507
+
508
+ st.subheader("📝 Claude Response Audio")
 
509
  play_and_download_audio(audio_file, st.session_state['audio_format'])
510
 
511
+ if st.checkbox("Run Arxiv Research AI"):
512
+ # --- 2) Arxiv RAG
513
+ st.write("Arxiv's AI this Evening is Mixtral 8x7B...")
514
+ client = Client("awacke1/Arxiv-Paper-Search-And-QA-RAG-Pattern")
515
+ refs = client.predict(
516
+ q,
517
+ #20,
518
+ 10,
519
+ "Semantic Search",
520
+ "mistralai/Mixtral-8x7B-Instruct-v0.1",
521
+ api_name="/update_with_rag_md"
522
+ )[0]
523
+
524
+ r2 = client.predict(
525
+ q,
526
+ "mistralai/Mixtral-8x7B-Instruct-v0.1",
527
+ True,
528
+ api_name="/ask_llm"
529
+ )
530
+
531
+ result = f"### 🔎 {q}\n\n{r2}\n\n{refs}"
532
+ md_file, audio_file = save_qa_with_audio(q, result)
533
+ st.subheader("📝 Main Response Audio")
534
+ play_and_download_audio(audio_file, st.session_state['audio_format'])
535
+
536
+ # --- 3) Parse + handle papers
537
+ papers = parse_arxiv_refs(refs)
538
+ if papers:
539
+ # Create minimal links page first
540
+ paper_links = create_paper_links_md(papers)
541
+ links_file = create_file(q, paper_links, "md")
542
+ st.markdown(paper_links)
543
+
544
+ # Then create audio for each paper
545
+ create_paper_audio_files(papers, input_question=q)
546
+ display_papers(papers, get_marquee_settings())
547
+ display_papers_in_sidebar(papers)
548
+ else:
549
+ st.warning("No papers found in the response.")
550
+
551
+ elapsed = time.time() - start
552
+ st.write(f"**Total Elapsed:** {elapsed:.2f} s")
553
+
554
  return result
555
 
556
  def process_voice_input(text):