Spaces:
Runtime error
Runtime error
File size: 1,699 Bytes
cdd3dc5 |
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 os
import gradio as gr
from huggingface_hub import create_discussion
token = os.environ["CLAIM"]
repo = "Team8/dataset"
description = """# <p style="text-align: center;"> Opt-Out from image datasets </p>
<span>This is a space to opt-out your images from some datasets. After you check that your image is in the dataset,
fill an explanation for why you want it to be removed. If you want to be notified when the image is removed,
fill your email. Additionally if you want to encrypt your issue opened on the dataset, check the Encrypt box.</span>"""
def open_issue(explanation, email, encrypt):
create_discussion(
repo_id=repo,
repo_type="dataset",
title="[OPT-OUT REQUEST] Remove image from the dataset",
description=explanation + "\n User email: " + email + "\n Encrypt: " + str(encrypt),
token = token,
)
# to do add issue id to the link
link = f"https://huggingface.co/datasets/{repo}/discussions"
return f"Issue opened at {link}"
demo = gr.Blocks()
with demo:
with gr.Row():
gr.Markdown(value=description)
with gr.Row():
with gr.Column():
explanation = gr.Textbox(lines=5, label="Please explain in a few lines why you want this image to be removed from the dataset.")
email = gr.Textbox(lines=1, label="Fill your email if you want to be notified when the image is removed.")
encrypt = gr.Checkbox(label="Encrypt my message")
run = gr.Button("Open an issue on the dataset")
output = gr.Textbox(lines=1, label="Opened issue link")
event = run.click(open_issue, [explanation, email, encrypt],output, api_name="open_issue")
demo.launch() |