File size: 1,020 Bytes
2bb9e53 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import gradio as gr
import os
from huggingface_hub import create_repo, upload_folder
block = gr.Blocks()
def build(hf_token):
os.system(f"mkdir xformers && cd xformers && pip wheel git+https://github.com/facebookresearch/xformers#egg=xformers")
repo_id = "camenduru/xformers-test-build"
path_in_repo = ""
create_repo(repo_id, private=True, token=hf_token)
upload_folder(folder_path="/content/xformers", path_in_repo=path_in_repo, repo_id=repo_id, commit_message=f"xformers", token=hf_token)
return "done"
def init():
with block:
gr.Markdown(
"""
[https://huggingface.co/settings/tokens](https://huggingface.co/settings/tokens)
""")
hf_token = gr.Textbox(show_label=False, max_lines=1, placeholder="🤗 token")
out = gr.Textbox(show_label=False)
btn = gr.Button("Push to 🤗")
btn.click(build, inputs=hf_token, outputs=out)
block.launch(server_name="0.0.0.0", server_port=7860)
if __name__ == "__main__":
init() |