RemoveMyArt / app.py
loubnabnl's picture
loubnabnl HF Staff
update
16cdbdb
raw
history blame
1.95 kB
import os
import gradio as gr
from huggingface_hub import create_discussion
token = "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"#os.environ["CLAIM"]
repo = "Team8/dataset"
# <p style="text-align: center; color: black;"> 🎨 <span style='color: #6d071a;'>FindMy</span>Art</p>
description = """# <p style="text-align: center; color: black;"> 🎨 <span style='color: #6d071a;'>FindMy</span>Art</p>
<span>This is a space to opt-out your images from datasets. After you check that your image is in the dataset,
fill an explanation for why you want it to be removed and specify if you want to encrypt the issue that will be opened on the dataset,
by checking 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(
css=".gradio-container {background-color: #fcf8ed; color:brown}"
)
with demo:
with gr.Row():
_, colum_2, _ = gr.Column(scale=1), gr.Column(scale=6), gr.Column(scale=1)
with colum_2:
gr.Markdown(value=description)
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()