tnt306's picture
Test Dataframe
86bff09
raw
history blame
834 Bytes
from typing import Dict
import gradio as gr
# def predict(text: str) -> Dict:
# return {"alive": 0.9, "death": 0.1}
example_list = [[1.0, 1.0, 0.0], [1.0, 0.0, 0.0], [0.0, 0.0, 0.0]]
# Create title, description and article strings
title = "This is title."
description = "This is description."
article = "This is article."
def filter_records(records, gender):
return records[records["gender"] == gender]
demo = gr.Interface(
filter_records,
[
gr.Dataframe(
headers=["name", "age", "gender"],
datatype=["str", "number", "str"],
row_count=5,
col_count=(3, "fixed"),
),
gr.Dropdown(["M", "F", "O"]),
],
"dataframe",
description="Enter gender as 'M', 'F', or 'O' for other.",
)
demo.launch(debug=False,
share=True)