fffiloni commited on
Commit
0d14e49
·
verified ·
1 Parent(s): d187fa4

add SDK choice option

Browse files
Files changed (1) hide show
  1. app.py +14 -6
app.py CHANGED
@@ -7,7 +7,7 @@ from huggingface_hub.utils import HfHubHTTPError
7
  api = HfApi()
8
 
9
 
10
- def process(git_repo_url, space_destination, user_token):
11
 
12
  your_username = api.whoami(token=user_token)["name"]
13
 
@@ -62,7 +62,7 @@ def process(git_repo_url, space_destination, user_token):
62
  token=user_token,
63
  private=True,
64
  repo_type="space",
65
- space_sdk="gradio"
66
  )
67
 
68
  print(f"New space repo created: {space_destination}")
@@ -90,16 +90,24 @@ with gr.Blocks(css=css) as demo:
90
  with gr.Column(elem_id="col-container"):
91
  gr.Markdown("# Clone GitHub repo to Space")
92
  git_repo_url = gr.Textbox(
93
- label="Git repo to clone"
 
94
  )
95
  with gr.Row():
96
  space_destination = gr.Textbox(
97
- label="Space ID"
 
98
  )
99
  user_token = gr.Textbox(
100
- label="Write permissions token",
101
  type="password"
102
  )
 
 
 
 
 
 
103
  submit_btn = gr.Button("Clone git repo to my space")
104
  status = gr.Textbox(
105
  label="Status"
@@ -107,7 +115,7 @@ with gr.Blocks(css=css) as demo:
107
 
108
  submit_btn.click(
109
  fn=process,
110
- inputs=[git_repo_url, space_destination, user_token],
111
  outputs=[status]
112
  )
113
 
 
7
  api = HfApi()
8
 
9
 
10
+ def process(git_repo_url, space_destination, user_token, space_sdk):
11
 
12
  your_username = api.whoami(token=user_token)["name"]
13
 
 
62
  token=user_token,
63
  private=True,
64
  repo_type="space",
65
+ space_sdk=space_sdk
66
  )
67
 
68
  print(f"New space repo created: {space_destination}")
 
90
  with gr.Column(elem_id="col-container"):
91
  gr.Markdown("# Clone GitHub repo to Space")
92
  git_repo_url = gr.Textbox(
93
+ label="Git repo URL to clone",
94
+ placeholder="https://github.com/username/my-repo.git"
95
  )
96
  with gr.Row():
97
  space_destination = gr.Textbox(
98
+ label="Space ID",
99
+ placeholder="your_hf_username/space_name"
100
  )
101
  user_token = gr.Textbox(
102
+ label="WRITE permissions HF token",
103
  type="password"
104
  )
105
+ space_sdk = gr.Radio(
106
+ label="Space SDK",
107
+ info="If specified space ID doesn't exist, a new private space will be created. In that case, please choose a SDK",
108
+ choices=["gradio", "docker", "static"],
109
+ value="gradio"
110
+ )
111
  submit_btn = gr.Button("Clone git repo to my space")
112
  status = gr.Textbox(
113
  label="Status"
 
115
 
116
  submit_btn.click(
117
  fn=process,
118
+ inputs=[git_repo_url, space_destination, user_token, space_sdk],
119
  outputs=[status]
120
  )
121