File size: 1,261 Bytes
6fa6cbc b83ce0e f8809d7 f292c1f b83ce0e 050ea6f f8809d7 6fa6cbc 505d576 f8809d7 505d576 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# 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
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)
from Mall_Customer import kmean_demo
df = pd.read_csv("dssv.csv", sep = ";", encoding='utf-8')
# df = pd.read_csv('Mall_Customers.csv')
def search_student(name):
"""
:param name:
:return:
"""
return (pd.DataFrame(df[df["Họ và tên"] == name.strip()]))
# search name service
inputs = [gr.Dataframe(row_count = (2, "dynamic"), col_count=(4,"dynamic"), label="Input Data", interactive=1)]
outputs = [gr.Dataframe(row_count = (2, "dynamic"), col_count=(16, "fixed"),interactive=1, label="Predictions")]
demo = gr.Interface(fn=search_student, inputs='text', outputs=outputs, examples = [[df.head(2)]])
demo.launch()
# ## Mall customer service v1
# inputs = [gr.Dataframe(label="Supersoaker Production Data")]
# outputs = [gr.Gallery(label="Profiling Dashboard", columns=[1], rows=[3], height="auto"), "text"]
# demo = gr.Interface(kmean_demo, inputs=inputs, outputs=outputs, examples=[df.head(100)],
# title="Supersoaker Failures Analysis Dashboard").launch() |