domcker-h-laude-bsdk / xformers.py
camenduru's picture
Create xformers.py
2bb9e53
raw
history blame
1.02 kB
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()