fabiogra commited on
Commit
878b9a1
1 Parent(s): 99a6014

fix: log error if file is not reachable

Browse files
Files changed (1) hide show
  1. app/helpers.py +6 -3
app/helpers.py CHANGED
@@ -4,14 +4,13 @@ import random
4
  from base64 import b64encode
5
  from io import BytesIO
6
  from pathlib import Path
 
7
 
8
  import matplotlib.pyplot as plt
9
  import numpy as np
10
  import streamlit as st
11
- from loguru import logger as log
12
  from PIL import Image
13
  from pydub import AudioSegment
14
-
15
  from streamlit.runtime.scriptrunner import RerunData, RerunException
16
  from streamlit.source_util import get_pages
17
  from streamlit_player import st_player
@@ -33,7 +32,11 @@ def url_is_valid(url):
33
  st.error("Extension not supported.")
34
  return False
35
  try:
36
- return check_file_availability(url)
 
 
 
 
37
  except Exception:
38
  st.error("URL is not valid.")
39
  return False
 
4
  from base64 import b64encode
5
  from io import BytesIO
6
  from pathlib import Path
7
+ from loguru import logger as log
8
 
9
  import matplotlib.pyplot as plt
10
  import numpy as np
11
  import streamlit as st
 
12
  from PIL import Image
13
  from pydub import AudioSegment
 
14
  from streamlit.runtime.scriptrunner import RerunData, RerunException
15
  from streamlit.source_util import get_pages
16
  from streamlit_player import st_player
 
32
  st.error("Extension not supported.")
33
  return False
34
  try:
35
+ if check_file_availability(url):
36
+ return True
37
+ else:
38
+ st.error("Not able to reach the URL.")
39
+ return False
40
  except Exception:
41
  st.error("URL is not valid.")
42
  return False