Commit
•
6702974
1
Parent(s):
33c8181
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ from git import Repo
|
|
4 |
import uuid
|
5 |
from slugify import slugify
|
6 |
|
7 |
-
def clone(profile: gr.OAuthProfile, oauth_token: gr.OAuthToken, repo_git, repo_hf):
|
8 |
folder = str(uuid.uuid4())
|
9 |
cloned_repo = Repo.clone_from(repo_git, folder)
|
10 |
|
@@ -13,6 +13,7 @@ def clone(profile: gr.OAuthProfile, oauth_token: gr.OAuthToken, repo_git, repo_h
|
|
13 |
api.create_repo(
|
14 |
f"{profile.username}/{slugify(repo_hf)}",
|
15 |
repo_type="space",
|
|
|
16 |
)
|
17 |
api.upload_folder(
|
18 |
folder_path=folder,
|
@@ -28,10 +29,11 @@ with gr.Blocks() as demo:
|
|
28 |
with gr.Column():
|
29 |
repo_git = gr.Textbox(label="GitHub Repository")
|
30 |
repo_hf = gr.Textbox(label="Hugging Face Space name")
|
|
|
31 |
with gr.Column():
|
32 |
output = gr.Textbox(label="Output repo")
|
33 |
btn = gr.Button("Bring over!")
|
34 |
-
btn.click(fn=clone, inputs=[repo_git, repo_hf], outputs=output)
|
35 |
|
36 |
if __name__ == "__main__":
|
37 |
demo.launch()
|
|
|
4 |
import uuid
|
5 |
from slugify import slugify
|
6 |
|
7 |
+
def clone(profile: gr.OAuthProfile, oauth_token: gr.OAuthToken, repo_git, repo_hf, sdk_type):
|
8 |
folder = str(uuid.uuid4())
|
9 |
cloned_repo = Repo.clone_from(repo_git, folder)
|
10 |
|
|
|
13 |
api.create_repo(
|
14 |
f"{profile.username}/{slugify(repo_hf)}",
|
15 |
repo_type="space",
|
16 |
+
space_sdk=sdk_type
|
17 |
)
|
18 |
api.upload_folder(
|
19 |
folder_path=folder,
|
|
|
29 |
with gr.Column():
|
30 |
repo_git = gr.Textbox(label="GitHub Repository")
|
31 |
repo_hf = gr.Textbox(label="Hugging Face Space name")
|
32 |
+
sdk_type = gr.Radio(['gradio', 'streamlit', 'docker', 'static'], label="SDK Type"),
|
33 |
with gr.Column():
|
34 |
output = gr.Textbox(label="Output repo")
|
35 |
btn = gr.Button("Bring over!")
|
36 |
+
btn.click(fn=clone, inputs=[repo_git, repo_hf, sdk_type], outputs=output)
|
37 |
|
38 |
if __name__ == "__main__":
|
39 |
demo.launch()
|