AlbertoFH98 commited on
Commit
66216e0
·
1 Parent(s): d85e9cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -5
app.py CHANGED
@@ -16,7 +16,8 @@ import time
16
  import os
17
  import re
18
 
19
- def main():
 
20
  st.set_page_config(layout="wide")
21
 
22
  # -- 1. Setup arguments
@@ -33,9 +34,22 @@ def main():
33
  logger = get_logger(__name__)
34
 
35
  # -- 3. Setup constants
 
 
 
 
 
 
 
 
 
 
 
 
36
  B_INST, E_INST = "[INST]", "[/INST]"
37
  B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>\n\n"
38
- args = parser.parse_args()
 
39
  PODCAST_URL_VIDEO_PATH = args.PODCAST_URL_VIDEO_PATH
40
  DEFAULT_SYSTEM_PROMPT_LINK = args.DEFAULT_SYSTEM_PROMPT_LINK
41
  TRANSCRIPTION = args.TRANSCRIPTION
@@ -43,9 +57,7 @@ def main():
43
  MODEL = args.MODEL
44
  EMB_MODEL = args.EMB_MODEL
45
 
46
- together.api_key = os.environ["TOGETHER_API_KEY"]
47
- together.Models.start(MODEL)
48
- podcast_url_video_df = pd.read_csv(PODCAST_URL_VIDEO_PATH, sep=';')
49
 
50
  r = requests.get("https://raw.githubusercontent.com/AlbertoUAH/Castena/main/media/castena-animated-icon.gif", stream=True)
51
  icon = Image.open(r.raw)
 
16
  import os
17
  import re
18
 
19
+ @st.cache
20
+ def get_args():
21
  st.set_page_config(layout="wide")
22
 
23
  # -- 1. Setup arguments
 
34
  logger = get_logger(__name__)
35
 
36
  # -- 3. Setup constants
37
+ args = parser.parse_args()
38
+ return args
39
+
40
+ @st.cache
41
+ def get_podcast_data(transcription_path):
42
+ together.api_key = os.environ["TOGETHER_API_KEY"]
43
+ together.Models.start(MODEL)
44
+ podcast_url_video_df = pd.read_csv(PODCAST_URL_VIDEO_PATH, sep=';')
45
+ return podcast_url_video_df
46
+
47
+ def main():
48
+ args = get_args()
49
  B_INST, E_INST = "[INST]", "[/INST]"
50
  B_SYS, E_SYS = "<<SYS>>\n", "\n<</SYS>>\n\n"
51
+
52
+ # -- 4. Get parameters
53
  PODCAST_URL_VIDEO_PATH = args.PODCAST_URL_VIDEO_PATH
54
  DEFAULT_SYSTEM_PROMPT_LINK = args.DEFAULT_SYSTEM_PROMPT_LINK
55
  TRANSCRIPTION = args.TRANSCRIPTION
 
57
  MODEL = args.MODEL
58
  EMB_MODEL = args.EMB_MODEL
59
 
60
+ podcast_url_video_df = get_podcast_data(TRANSCRIPTION_PATH)
 
 
61
 
62
  r = requests.get("https://raw.githubusercontent.com/AlbertoUAH/Castena/main/media/castena-animated-icon.gif", stream=True)
63
  icon = Image.open(r.raw)