DrishtiSharma commited on
Commit
3aca8d3
Β·
verified Β·
1 Parent(s): 97d365f

Update best_app.py

Browse files
Files changed (1) hide show
  1. best_app.py +22 -6
best_app.py CHANGED
@@ -1,6 +1,9 @@
1
  # add support for multiple pdf/pdf urls + audio query + generate qa audio
2
  # include - key features of the app + limitations + future work + workflow diagram + sample outputs
3
  #
 
 
 
4
  import streamlit as st
5
  import os
6
  from openai import OpenAI
@@ -123,15 +126,16 @@ class DocumentRAG:
123
  model="gpt-4",
124
  messages=[
125
  {"role": "system", "content": f"""
126
- Summarize the following document focusing mainly on these sections:
 
 
127
  1. Abstract
128
- 2. In the Introduction, specifically focus on the portion where the key contributions of the research paper are highlighted.
129
  3. Conclusion
130
  4. Limitations
131
  5. Future Work
132
-
133
- Ensure the summary is concise, logically ordered, and suitable for {language}.
134
- Provide 7-9 key points for discussion in a structured format."""},
135
  {"role": "user", "content": text[:4000]}
136
  ],
137
  temperature=0.3
@@ -355,8 +359,20 @@ if st.session_state.rag_system.document_summary:
355
  if audio_path:
356
  st.text_area("Generated Podcast Script", script, height=200)
357
  st.audio(audio_path, format="audio/mp3")
 
 
 
 
 
 
 
 
 
 
 
 
358
  st.success("Podcast generated successfully! You can listen to it above.")
359
  else:
360
  st.error(script)
361
  else:
362
- st.info("Please process documents and generate summary before creating a podcast.")
 
1
  # add support for multiple pdf/pdf urls + audio query + generate qa audio
2
  # include - key features of the app + limitations + future work + workflow diagram + sample outputs
3
  #
4
+ # add support for multiple pdf/pdf urls + audio query + generate qa audio
5
+ # include - key features of the app + limitations + future work + workflow diagram + sample outputs
6
+ #
7
  import streamlit as st
8
  import os
9
  from openai import OpenAI
 
126
  model="gpt-4",
127
  messages=[
128
  {"role": "system", "content": f"""
129
+ Summarize the following document in **{language}**.
130
+
131
+ While generating summary, focus mainly on the following sections of the document:
132
  1. Abstract
133
+ 2. In the Introduction, highlight key contributions.
134
  3. Conclusion
135
  4. Limitations
136
  5. Future Work
137
+ Write the summary entirely in **{language}**. Provide 7–9 key points in bullet format. Be concise and well-structured.
138
+ """},
 
139
  {"role": "user", "content": text[:4000]}
140
  ],
141
  temperature=0.3
 
359
  if audio_path:
360
  st.text_area("Generated Podcast Script", script, height=200)
361
  st.audio(audio_path, format="audio/mp3")
362
+
363
+ # Add this block to enable download
364
+ with open(audio_path, "rb") as audio_file:
365
+ st.download_button(
366
+ label="Download Podcast (.mp3)",
367
+ data=audio_file,
368
+ file_name="podcast.mp3",
369
+ mime="audio/mpeg"
370
+ )
371
+
372
+
373
+
374
  st.success("Podcast generated successfully! You can listen to it above.")
375
  else:
376
  st.error(script)
377
  else:
378
+ st.info("Please process documents and generate summary before creating a podcast.")