nickmuchi commited on
Commit
a2a2e1d
·
verified ·
1 Parent(s): c8ec90e

Update functions.py

Browse files
Files changed (1) hide show
  1. functions.py +37 -0
functions.py CHANGED
@@ -8,6 +8,10 @@ import wikipedia
8
  import json
9
  import streamlit as st
10
  import requests
 
 
 
 
11
 
12
  client = OpenAI()
13
 
@@ -21,6 +25,39 @@ client = OpenAI()
21
 
22
  # return transcript
23
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
24
  @st.cache_data
25
  def load_whisper_api(audio):
26
 
 
8
  import json
9
  import streamlit as st
10
  import requests
11
+ from docx import Document
12
+ from docx.shared import Pt
13
+ from docx.enum.text import WD_PARAGRAPH_ALIGNMENT
14
+ import io
15
 
16
  client = OpenAI()
17
 
 
25
 
26
  # return transcript
27
 
28
+ def export_to_word(podcast_info):
29
+ # Create a new Word document
30
+ doc = Document()
31
+ doc.add_heading(podcast_info['title'], 0)
32
+
33
+ # Adding podcast summary
34
+ p = doc.add_paragraph()
35
+ run = p.add_run("Podcast Summary:\n")
36
+ run.bold = True
37
+ run.font.size = Pt(12)
38
+ p.add_run(podcast_info['podcast_summary'])
39
+
40
+ # Adding podcast guest details
41
+ p = doc.add_paragraph()
42
+ run = p.add_run("\nPodcast Guest:\n")
43
+ run.bold = True
44
+ run.font.size = Pt(12)
45
+ p.add_run(podcast_info['podcast_guest'])
46
+
47
+ # Adding key moments
48
+ p = doc.add_paragraph()
49
+ run = p.add_run("\nKey Moments:\n")
50
+ run.bold = True
51
+ run.font.size = Pt(12)
52
+ p.add_run(podcast_info['podcast_highlights'])
53
+
54
+ # Save the document to a byte stream
55
+ byte_io = io.BytesIO()
56
+ doc.save(byte_io)
57
+ byte_io.seek(0)
58
+
59
+ return byte_io
60
+
61
  @st.cache_data
62
  def load_whisper_api(audio):
63