flagging / app.py
Abubakar Abid
Update app.py
cbceffb
raw
history blame
661 Bytes
#### ignore these lines -- just needed to install and build a particular branch
import os
os.system("git clone https://github.com/gradio-app/gradio.git gradio")
os.system("cd gradio && git fetch && git checkout flagging-spaces")
os.system("pip uninstall -y gradio")
os.system("cd gradio && pip install -e .")
os.system("cd gradio/frontend && npm install && npm run build")
### Real code is below
### -------------------------
import gradio as gr
HF_TOKEN = os.getenv('HF_TOKEN')
hf_saver = gr.HuggingFaceDatasetSaver(HF_TOKEN, "test-image-classifier-dataset")
gr.Interface.load("huggingface/google/vit-base-patch16-224", flagging_callback=hf_saver).launch()