AlbertoFH98 commited on
Commit
f7efdfb
·
1 Parent(s): 338e898

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -194,26 +194,26 @@ RESPUESTA: """
194
  else:
195
  if prompt.lower() == 'resume':
196
  llm_response = utils.summarise_doc(TRANSCRIPTION_PATH)
 
197
  else:
198
  llm_response = utils.get_gpt_response(TRANSCRIPTION_PATH, prompt, logger)
199
-
200
- llm_response = utils.process_llm_response(llm_response)
201
- st.markdown(llm_response)
202
-
203
- start_time_str_list = []; start_time_seconds_list = []; end_time_seconds_list = []
204
- for response in llm_response.split('\n'):
205
- if re.search(r'(\d{2}:\d{2}:\d{2}(.\d{6})?)', response) != None:
206
- start_time_str, start_time_seconds, _, end_time_seconds = utils.add_hyperlink_and_convert_to_seconds(response)
207
- start_time_str_list.append(start_time_str)
208
- start_time_seconds_list.append(start_time_seconds)
209
- end_time_seconds_list.append(end_time_seconds)
210
-
211
- if start_time_str_list:
212
- for start_time_seconds, start_time_str, end_time_seconds in zip(start_time_seconds_list, start_time_str_list, end_time_seconds_list):
213
- st.markdown("__Fragmento: " + start_time_str + "__")
214
- _, container, _ = st.columns([SIDE, WIDTH, SIDE])
215
- with container:
216
- st_player(youtube_video_url.replace("?enablejsapi=1", "") + f'?start={start_time_seconds}&end={end_time_seconds}')
217
 
218
  st.session_state.messages.append({"role": "assistant", "content": llm_response})
219
  # -- Sample: streamlit run app.py -- --DEFAULT_SYSTEM_PROMPT_LINK=https://raw.githubusercontent.com/AlbertoUAH/Castena/main/prompts/default_system_prompt.txt --PODCAST_URL_VIDEO_PATH=https://raw.githubusercontent.com/AlbertoUAH/Castena/main/data/podcast_youtube_video.csv --TRANSCRIPTION=worldcast_roberto_vaquero --MODEL=togethercomputer/llama-2-7b-chat --EMB_MODEL=BAAI/bge-base-en-v1.5
 
194
  else:
195
  if prompt.lower() == 'resume':
196
  llm_response = utils.summarise_doc(TRANSCRIPTION_PATH)
197
+ st.markdown(llm_response)
198
  else:
199
  llm_response = utils.get_gpt_response(TRANSCRIPTION_PATH, prompt, logger)
200
+ llm_response = utils.process_llm_response(llm_response)
201
+ st.markdown(llm_response)
202
+
203
+ start_time_str_list = []; start_time_seconds_list = []; end_time_seconds_list = []
204
+ for response in llm_response.split('\n'):
205
+ if re.search(r'(\d{2}:\d{2}:\d{2}(.\d{6})?)', response) != None:
206
+ start_time_str, start_time_seconds, _, end_time_seconds = utils.add_hyperlink_and_convert_to_seconds(response)
207
+ start_time_str_list.append(start_time_str)
208
+ start_time_seconds_list.append(start_time_seconds)
209
+ end_time_seconds_list.append(end_time_seconds)
210
+
211
+ if start_time_str_list:
212
+ for start_time_seconds, start_time_str, end_time_seconds in zip(start_time_seconds_list, start_time_str_list, end_time_seconds_list):
213
+ st.markdown("__Fragmento: " + start_time_str + "__")
214
+ _, container, _ = st.columns([SIDE, WIDTH, SIDE])
215
+ with container:
216
+ st_player(youtube_video_url.replace("?enablejsapi=1", "") + f'?start={start_time_seconds}&end={end_time_seconds}')
 
217
 
218
  st.session_state.messages.append({"role": "assistant", "content": llm_response})
219
  # -- Sample: streamlit run app.py -- --DEFAULT_SYSTEM_PROMPT_LINK=https://raw.githubusercontent.com/AlbertoUAH/Castena/main/prompts/default_system_prompt.txt --PODCAST_URL_VIDEO_PATH=https://raw.githubusercontent.com/AlbertoUAH/Castena/main/data/podcast_youtube_video.csv --TRANSCRIPTION=worldcast_roberto_vaquero --MODEL=togethercomputer/llama-2-7b-chat --EMB_MODEL=BAAI/bge-base-en-v1.5