omerXfaruq commited on
Commit
bf5fb31
1 Parent(s): 7e0c7d3

-add exception prints to logs

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -50,6 +50,7 @@ class SpaceBuilder:
50
  temp_file.write(file_string)
51
  temp_file.close()
52
  except Exception as ex:
 
53
  cls.error_message = "An exception occurred during temporary file writing"
54
  return False
55
 
@@ -63,6 +64,7 @@ class SpaceBuilder:
63
  )
64
  return True
65
  except Exception as ex:
 
66
  cls.error_message = "An exception occurred during writing app.py to the target space"
67
  return False
68
 
@@ -78,6 +80,7 @@ class SpaceBuilder:
78
  try:
79
  interfaces = [gr.Interface.load(name) for name in name_list]
80
  except Exception as ex:
 
81
  cls.error_message = "One of the given models cannot be loaded to gradio, sorry for the inconvenience"
82
  return False
83
  if not cls.control_input_and_output_types(interfaces):
@@ -124,6 +127,7 @@ class SpaceBuilder:
124
  try:
125
  repo_name = get_full_repo_name(model_id=space_name, token=hf_token)
126
  except Exception as ex:
 
127
  cls.error_message = "You have given an incorrect HuggingFace token"
128
  return False
129
  url = f"https://huggingface.co/spaces/{repo_name}"
@@ -147,7 +151,7 @@ class SpaceBuilder:
147
  """
148
  if space_names == "" or hf_token == "" or target_space_name == "" or space_description == "":
149
  return "Please fill all the inputs"
150
- if SpaceBuilder.check_space_name_availability(hf_token, target_space_name):
151
  print("The space name is available")
152
  if SpaceBuilder.load_and_check_spaces(names=space_names):
153
  print("Loaded and checked input spaces")
 
50
  temp_file.write(file_string)
51
  temp_file.close()
52
  except Exception as ex:
53
+ print(ex)
54
  cls.error_message = "An exception occurred during temporary file writing"
55
  return False
56
 
 
64
  )
65
  return True
66
  except Exception as ex:
67
+ print(ex)
68
  cls.error_message = "An exception occurred during writing app.py to the target space"
69
  return False
70
 
 
80
  try:
81
  interfaces = [gr.Interface.load(name) for name in name_list]
82
  except Exception as ex:
83
+ print(ex)
84
  cls.error_message = "One of the given models cannot be loaded to gradio, sorry for the inconvenience"
85
  return False
86
  if not cls.control_input_and_output_types(interfaces):
 
127
  try:
128
  repo_name = get_full_repo_name(model_id=space_name, token=hf_token)
129
  except Exception as ex:
130
+ print(ex)
131
  cls.error_message = "You have given an incorrect HuggingFace token"
132
  return False
133
  url = f"https://huggingface.co/spaces/{repo_name}"
 
151
  """
152
  if space_names == "" or hf_token == "" or target_space_name == "" or space_description == "":
153
  return "Please fill all the inputs"
154
+ if SpaceBuilder.check_space_name_availability(hf_token=hf_token, space_name=target_space_name):
155
  print("The space name is available")
156
  if SpaceBuilder.load_and_check_spaces(names=space_names):
157
  print("Loaded and checked input spaces")