Commit
•
510422f
1
Parent(s):
52acbfc
Update app.py
Browse files
app.py
CHANGED
@@ -1,18 +1,20 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
|
4 |
-
def
|
5 |
-
|
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
|
16 |
with gr.Column(scale=4):
|
17 |
gr.Markdown(
|
18 |
f"""
|
@@ -49,7 +51,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
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="""
|
@@ -62,7 +64,7 @@ with gr.Blocks(css="style.css") as demo:
|
|
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="""
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
|
4 |
+
def name_to_markdown(name, network):
|
5 |
+
if(network == "twitter"):
|
6 |
+
return f"[{name}](https://twitter.com/{name})"
|
7 |
+
else:
|
8 |
+
return f"[{name}](https://huggingface.co/{name})"
|
9 |
+
|
10 |
def show_template(name, description, authors, url, image_url, more_info=None):
|
11 |
if isinstance(authors, str):
|
12 |
authors = [authors]
|
13 |
+
authors_md = ", ".join([name_to_hf_markdown(author, network) for author, network in authors])
|
14 |
with gr.Box():
|
15 |
with gr.Row():
|
16 |
with gr.Column(scale=1):
|
17 |
+
gr.HTML(f'''<img src="{image_url}" alt="{name}-thumbnail" height=256 width=256>''')
|
18 |
with gr.Column(scale=4):
|
19 |
gr.Markdown(
|
20 |
f"""
|
|
|
51 |
show_template(
|
52 |
name="JupyterLab",
|
53 |
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.",
|
54 |
+
authors=[("camenduru", "twitter"), ("nateraw", "huggingface")],
|
55 |
url="https://huggingface.co/spaces/DockerTemplates/jupyterlab?duplicate=true",
|
56 |
image_url="https://upload.wikimedia.org/wikipedia/commons/thumb/3/38/Jupyter_logo.svg/1767px-Jupyter_logo.svg.png",
|
57 |
more_info="""
|
|
|
64 |
show_template(
|
65 |
name="VSCode",
|
66 |
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.",
|
67 |
+
authors=[("camenduru", "twitter"), ("nateraw", "huggingface")],
|
68 |
url="https://huggingface.co/spaces/DockerTemplates/vscode?duplicate=true",
|
69 |
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",
|
70 |
more_info="""
|