nateraw commited on
Commit
d6c2a2b
β€’
1 Parent(s): ada3ee3

Synced repo using 'sync_with_huggingface' Github Action

Browse files
Files changed (2) hide show
  1. app.py +67 -0
  2. style.css +3 -0
app.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+
4
+ def show_template(name, description, author, url, image_url, more_info=None):
5
+ with gr.Box():
6
+ with gr.Row():
7
+ with gr.Column(scale=1):
8
+ gr.HTML(f"""<img src="{image_url}" alt="{name}-thumbnail" height=256 width=256>""")
9
+ with gr.Column(scale=4):
10
+ gr.Markdown(f"""
11
+ ## {name}
12
+ [![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})
13
+
14
+ #### {description}
15
+ """)
16
+ if more_info:
17
+ with gr.Row():
18
+ with gr.Accordion("πŸ‘€ More Details", open=False):
19
+ gr.Markdown(more_info)
20
+
21
+
22
+ title_and_description = """
23
+ # Spaces Templates
24
+
25
+ <div align="center">
26
+ <a src="https://img.shields.io/github/stars/nateraw/spaces-docker-templates?style=social" href="https://github.com/nateraw/spaces-docker-templates" target="_blank">
27
+ <img src="https://img.shields.io/github/stars/nateraw/spaces-docker-templates?label=Contribute&style=social" alt="GitHub Stars">
28
+ </a>
29
+
30
+ <h4>πŸš€ A collection of templates for <a href="https://huggingface.co/spaces">Hugging Face Spaces</a></h4>
31
+
32
+ The templates below are designed to help you get started with Docker Spaces. Duplicate them to get started with your own project. πŸ€—
33
+ </div>
34
+ """
35
+
36
+ with gr.Blocks(css="style.css") as demo:
37
+ gr.Markdown(title_and_description)
38
+ show_template(
39
+ name="JupyterLab",
40
+ 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.",
41
+ author="nateraw",
42
+ url="https://huggingface.co/spaces/DockerTemplates/jupyterlab?duplicate=true",
43
+ image_url="https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Jupyter_logo.svg/1767px-Jupyter_logo.svg.png",
44
+ more_info="""
45
+ ### Configuration
46
+ - You can add dependencies to your JupyterLab instance by editing the `requirements.txt` file.
47
+ - You can add linux packages to your JupyterLab instance by editing the `packages.txt` file.
48
+ - You can add custom startup commands to your JupyterLab instance by editing the `on_startup.sh` file. These run with the root user.
49
+ """
50
+ )
51
+ show_template(
52
+ name="VSCode",
53
+ 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.",
54
+ author="nateraw",
55
+ url="https://huggingface.co/spaces/DockerTemplates/vscode?duplicate=true",
56
+ 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",
57
+ more_info="""
58
+ ### Configuration
59
+ - You can add dependencies to your VSCode instance by editing the `requirements.txt` file.
60
+ - You can add linux packages to your VSCode instance by editing the `packages.txt` file.
61
+ - You can add custom startup commands to your VSCode instance by editing the `on_startup.sh` file. These run with the root user.
62
+ """,
63
+ )
64
+
65
+
66
+ if __name__ == "__main__":
67
+ demo.launch()
style.css ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ h1 {
2
+ text-align: center;
3
+ }