Last active
November 8, 2024 12:55
-
-
Save fffiloni/fcda01da35d915e8c50150e8bb1f97a4 to your computer and use it in GitHub Desktop.
Gradio base template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gradio as gr | |
def infer(*args): | |
# ... | |
return "done" | |
css = """ | |
div#col-container{ | |
margin: 0 auto; | |
max-width: 800px; | |
""" | |
with gr.Blocks(css=css) as demo: | |
with gr.Column(elem_id="col-container"): | |
gr.Markdown("# TITLE") | |
gr.Markdown("DESCRIPTION") | |
gr.HTML(""" | |
<div style="display:flex;column-gap:4px;"> | |
<a href="<LINK TO GITHUB REPO>"> | |
<img src='https://img.shields.io/badge/GitHub-Repo-blue'> | |
</a> | |
<a href="<LINK TO PROJECT PAGE>"> | |
<img src='https://img.shields.io/badge/Project-Page-green'> | |
</a> | |
<a href="<LINK TO ARXIV PAPER>"> | |
<img src='https://img.shields.io/badge/ArXiv-Paper-red'> | |
</a> | |
</div> | |
""") | |
gr.HTML(""" | |
<div style="display:flex;column-gap:4px;"> | |
<a href="<LINK TO HF SPACE>?duplicate=true"> | |
<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/duplicate-this-space-sm.svg" alt="Duplicate this Space"> | |
</a> | |
<a href="https://huggingface.co/fffiloni"> | |
<img src="https://huggingface.co/datasets/huggingface/badges/resolve/main/follow-me-on-HF-sm-dark.svg" alt="Follow me on HF"> | |
</a> | |
</div> | |
""") | |
with gr.Row(): | |
with gr.Column(): | |
# INPUTS COMPONENTS | |
# ... | |
submit_btn = gr.Button("Submit") | |
with gr.Column(): | |
# OUTPUTS COMPONENTS | |
# ... | |
submit_btn.click( | |
fn = infer, | |
inputs = [], | |
outputs = [] | |
) | |
demo.queue().launch(show_error=True, show_api=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment