safety-card / app.py
mmathys's picture
updates
f6bcba8
raw
history blame
1.62 kB
#%%
import gradio as gr
def greet(name):
return "Hello " + name + "!!"
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()
# %%
import gradio as gr
def sentence_builder(model, dataset):
return f"Model card for {model} and {dataset}."
demo = gr.Interface(
sentence_builder,
[
gr.Dropdown(
["microsoft/resnet-34", "microsoft/resnet-50"], label="Model", info="Select a model to use for testing."
),
gr.Dropdown(
["marmal88/skin_cancer"], label="Dataset", info="Select the sampling dataset to use for testing."
),
#gr.CheckboxGroup(["USA", "Japan", "Pakistan"], label="Countries", info="Where are they from?"),
#gr.Radio(["park", "zoo", "road"], label="Location", info="Where did they go?"),
#gr.Dropdown(
# ["ran", "swam", "ate", "slept"], value=["swam", "slept"], multiselect=True, label="Activity", info="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed auctor, nisl eget ultricies aliquam, nunc nisl aliquet nunc, eget aliquam nisl nunc vel nisl."
#),
#gr.Checkbox(label="Morning", info="Did they do it in the morning?"),
],
gr.Label(num_top_classes=4),
examples=[
["microsoft/resnet-34", "marmal88/skin_cancer"],
#[2, "cat", ["Japan", "Pakistan"], "park", ["ate", "swam"], True],
#[4, "dog", ["Japan"], "zoo", ["ate", "swam"], False],
#[10, "bird", ["USA", "Pakistan"], "road", ["ran"], False],
#[8, "cat", ["Pakistan"], "zoo", ["ate"], True],
]
)
if __name__ == "__main__":
demo.launch()