import gradio as gr
def name_to_markdown(name, network):
if(network == "twitter"):
return f"[{name}](https://twitter.com/{name})"
else:
return f"[{name}](https://huggingface.co/{name})"
def show_template(name, description, authors, url, image_url, more_info=None):
if isinstance(authors, str):
authors = [authors]
authors_md = ", ".join([name_to_markdown(author, network) for author, network in authors])
with gr.Group():
with gr.Row():
with gr.Column(scale=1):
gr.HTML(f'''''')
with gr.Column(scale=4):
gr.Markdown(
f"""
## {name}
[![Open In Colab](https://img.shields.io/badge/-Duplicate%20Space-blue?labelColor=white&style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAP5JREFUOE+lk7FqAkEURY+ltunEgFXS2sZGIbXfEPdLlnxJyDdYB62sbbUKpLbVNhyYFzbrrA74YJlh9r079973psed0cvUD4A+4HoCjsA85X0Dfn/RBLBgBDxnQPfAEJgBY+A9gALA4tcbamSzS4xq4FOQAJgCDwV2CPKV8tZAJcAjMMkUe1vX+U+SMhfAJEHasQIWmXNN3abzDwHUrgcRGmYcgKe0bxrblHEB4E/pndMazNpSZGcsZdBlYJcEL9Afo75molJyM2FxmPgmgPqlWNLGfwZGG6UiyEvLzHYDmoPkDDiNm9JR9uboiONcBXrpY1qmgs21x1QwyZcpvxt9NS09PlsPAAAAAElFTkSuQmCC&logoWidth=14)]({url})
#### {description}
**Author(s):** {authors_md}
"""
)
if more_info:
with gr.Row():
with gr.Accordion("👀 More Details", open=False):
gr.Markdown(more_info)
title_and_description = """
# Spaces Templates