freddyaboulton HF staff commited on
Commit
fb18c58
1 Parent(s): 856bd30

private dataset

Browse files
Files changed (1) hide show
  1. app.py +30 -0
app.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pandas as pd
2
+ import gradio as gr
3
+ from huggingface_hub import hf_hub_download
4
+ import os
5
+
6
+ guest_list = hf_hub_download("freddyaboulton/names", "guests.csv", repo_type="dataset",
7
+ token=os.environ["TOKEN"])
8
+
9
+
10
+ GUESTS = set(pd.read_csv(guest_list).Name.str.lower())
11
+
12
+ def checkin(s: str):
13
+ s = s.lower()
14
+ color = "green" if s in GUESTS else "red"
15
+ value = "on list" if s in GUESTS else "not on list"
16
+ return gr.Label.update(value=value, color=color)
17
+
18
+ with gr.Blocks() as demo:
19
+ with gr.Row():
20
+ with gr.Column():
21
+ name = gr.Textbox(label="Name", info="Name on Partiful. Case insensitive. Hit enter or button")
22
+ checkin_btn = gr.Button(value="Check in")
23
+ # add = gr.Button(value="Add name to list")
24
+ with gr.Column():
25
+ result = gr.Label(label="Are they on the list?")
26
+ name.submit(checkin, name, result)
27
+ checkin_btn.click(checkin, name, result)
28
+ # add.click(add_to_list, name, None)
29
+
30
+ demo.launch(enable_queue=False)