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