PeepDaSlan9 nateraw commited on
Commit
ecd0f03
·
0 Parent(s):

Duplicate from SpacesExamples/docker-examples

Browse files

Co-authored-by: Nate Raw <[email protected]>

Files changed (4) hide show
  1. .gitattributes +34 -0
  2. README.md +13 -0
  3. app.py +78 -0
  4. style.css +3 -0
.gitattributes ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tflite filter=lfs diff=lfs merge=lfs -text
29
+ *.tgz filter=lfs diff=lfs merge=lfs -text
30
+ *.wasm filter=lfs diff=lfs merge=lfs -text
31
+ *.xz filter=lfs diff=lfs merge=lfs -text
32
+ *.zip filter=lfs diff=lfs merge=lfs -text
33
+ *.zst filter=lfs diff=lfs merge=lfs -text
34
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Docker Examples
3
+ emoji: 🐳
4
+ colorFrom: blue
5
+ colorTo: gray
6
+ sdk: gradio
7
+ sdk_version: 3.18.0
8
+ app_file: app.py
9
+ pinned: true
10
+ duplicated_from: SpacesExamples/docker-examples
11
+ ---
12
+
13
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+
4
+ def name_to_hf_markdown(name):
5
+ return f"[{name}](https://huggingface.co/{name})"
6
+
7
+
8
+ def show_template(name, description, authors, url, image_url, more_info=None):
9
+ if isinstance(authors, str):
10
+ authors = [authors]
11
+ authors_md = ", ".join([name_to_hf_markdown(author) for author in authors])
12
+ with gr.Box():
13
+ with gr.Row():
14
+ with gr.Column(scale=1):
15
+ gr.HTML(f"""<img src="{image_url}" alt="{name}-thumbnail" height=256 width=256>""")
16
+ with gr.Column(scale=4):
17
+ gr.Markdown(
18
+ f"""
19
+ ## {name}
20
+ [![Open In Colab](https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&amp;style=flat&amp;logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&amp;logoWidth=14)]({url})
21
+
22
+ #### {description}
23
+
24
+ **Author(s):** {authors_md}
25
+ """
26
+ )
27
+ if more_info:
28
+ with gr.Row():
29
+ with gr.Accordion("👀 More Details", open=False):
30
+ gr.Markdown(more_info)
31
+
32
+
33
+ title_and_description = """
34
+ # Spaces Templates
35
+
36
+ <div align="center">
37
+ <a src="https://img.shields.io/github/stars/nateraw/spaces-docker-templates?style=social" href="https://github.com/nateraw/spaces-docker-templates" target="_blank">
38
+ <img src="https://img.shields.io/github/stars/nateraw/spaces-docker-templates?label=Contribute&style=social" alt="GitHub Stars">
39
+ </a>
40
+
41
+ <h4>🚀 A collection of templates for <a href="https://huggingface.co/spaces">Hugging Face Spaces</a></h4>
42
+
43
+ The templates below are designed to help you get started with Docker Spaces. Duplicate them to get started with your own project. 🤗
44
+ </div>
45
+ """
46
+
47
+ with gr.Blocks(css="style.css") as demo:
48
+ gr.Markdown(title_and_description)
49
+ show_template(
50
+ name="JupyterLab",
51
+ description="Spin up a JupyterLab instance with just a couple clicks. This template is great for data exploration, model training, and more. Works on CPU and GPU hardware.",
52
+ authors=["camenduru", "nateraw"],
53
+ url="https://huggingface.co/spaces/DockerTemplates/jupyterlab?duplicate=true",
54
+ image_url="https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Jupyter_logo.svg/1767px-Jupyter_logo.svg.png",
55
+ more_info="""
56
+ ### Configuration
57
+ - You can add dependencies to your JupyterLab instance by editing the `requirements.txt` file.
58
+ - You can add linux packages to your JupyterLab instance by editing the `packages.txt` file.
59
+ - You can add custom startup commands to your JupyterLab instance by editing the `on_startup.sh` file. These run with the root user.
60
+ """,
61
+ )
62
+ show_template(
63
+ name="VSCode",
64
+ description="Spin up a VSCode instance with just a couple clicks. This template is great for data exploration, model training, and more. Works on CPU and GPU hardware.",
65
+ authors=["camenduru", "nateraw"],
66
+ url="https://huggingface.co/spaces/DockerTemplates/vscode?duplicate=true",
67
+ image_url="https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Visual_Studio_Code_1.35_icon.svg/1200px-Visual_Studio_Code_1.35_icon.svg.png",
68
+ more_info="""
69
+ ### Configuration
70
+ - You can add dependencies to your VSCode instance by editing the `requirements.txt` file.
71
+ - You can add linux packages to your VSCode instance by editing the `packages.txt` file.
72
+ - You can add custom startup commands to your VSCode instance by editing the `on_startup.sh` file. These run with the root user.
73
+ """,
74
+ )
75
+
76
+
77
+ if __name__ == "__main__":
78
+ demo.launch()
style.css ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ h1 {
2
+ text-align: center;
3
+ }