omerXfaruq commited on
Commit
fdd6860
1 Parent(s): 9d54728

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -4,6 +4,7 @@ import numpy as np
4
  import requests
5
  import gradio as gr
6
  import time
 
7
 
8
  from huggingface_hub import (
9
  create_repo,
@@ -203,12 +204,13 @@ class SpaceBuilder:
203
  """
204
  if (
205
  space_names == "" or space_names.isspace()
206
- or hf_token == "" or hf_token.isspace()
207
  or target_space_name == "" or target_space_name.isspace()
208
  or interface_title == "" or interface_title.isspace()
209
  or interface_description == "" or interface_description.isspace()
210
  ):
211
  return "Please fill all the inputs"
 
 
212
  if not SpaceBuilder.check_space_name_availability(hf_token=hf_token, space_name=target_space_name):
213
  return SpaceBuilder.error_message
214
  if not SpaceBuilder.load_and_check_spaces(names=space_names):
@@ -236,8 +238,8 @@ if __name__ == "__main__":
236
  gr.inputs.Textbox(lines=1, placeholder="Title for the target space interface, ie. Title"),
237
  gr.inputs.Textbox(lines=1, placeholder="Description for the target space interface, ie. Description"),
238
  ],
239
- title="Space that builds another Space",
240
- description="I can create a comparative space which will compare the models and spaces you provide to me. You can get your HF Write Token from [here](https://huggingface.co/settings/tokens)",
241
  outputs="text",
242
  )
243
  iface.launch()
 
4
  import requests
5
  import gradio as gr
6
  import time
7
+ import os
8
 
9
  from huggingface_hub import (
10
  create_repo,
 
204
  """
205
  if (
206
  space_names == "" or space_names.isspace()
 
207
  or target_space_name == "" or target_space_name.isspace()
208
  or interface_title == "" or interface_title.isspace()
209
  or interface_description == "" or interface_description.isspace()
210
  ):
211
  return "Please fill all the inputs"
212
+ if hf_token == "" or hf_token.isspace():
213
+ hf_token = os.environ('HF_SELF_TOKEN')
214
  if not SpaceBuilder.check_space_name_availability(hf_token=hf_token, space_name=target_space_name):
215
  return SpaceBuilder.error_message
216
  if not SpaceBuilder.load_and_check_spaces(names=space_names):
 
238
  gr.inputs.Textbox(lines=1, placeholder="Title for the target space interface, ie. Title"),
239
  gr.inputs.Textbox(lines=1, placeholder="Description for the target space interface, ie. Description"),
240
  ],
241
+ title="Space that builds Comparison Spaces",
242
+ description="I can create a comparative space which will compare the models and/or spaces you provide to me. You can get your HF Write Token from [here](https://huggingface.co/settings/tokens). If you leave HF Token input empty, the space will release under my name. Finally, you can publish spaces as a clone of other spaces if you provide just a single model or space. Have fun :)",
243
  outputs="text",
244
  )
245
  iface.launch()