Last active
January 7, 2022 08:24
-
-
Save fmind/c2dd9e4a5c848d260c0003170d2ea73f to your computer and use it in GitHub Desktop.
Snippets for Gradio app.
This file contains 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
"""Start a simple Gradio application.""" | |
# IMPORTS | |
import gradio as gr | |
# CONFIGS | |
TITLE = "Gradio App" | |
ARTICLE = """ | |
# Instructions | |
TODO | |
""" | |
# FUNCTIONS | |
def gui_fn(x: int) -> int: | |
"""Increment a number.""" | |
return x + 1 | |
# INTERFACES | |
inputs = [ | |
gr.inputs.Slider( | |
label="X", | |
default=0, | |
), | |
] | |
outputs = [ | |
gr.outputs.Textbox( | |
label="Y", | |
type="number", | |
), | |
] | |
gui = gr.Interface( | |
# main | |
fn=gui_fn, | |
inputs=inputs, | |
outputs=outputs, | |
# meta | |
title=TITLE, | |
article=ARTICLE, | |
# flags | |
allow_flagging=False, | |
allow_screenshot=False, | |
) | |
# CONDITIONS | |
if __name__ == "__main__": | |
gui.launch(debug=True) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment