about / app.py
clem's picture
clem HF staff
edit link to community tab to redirect to this space community tab
ba71c34
raw history blame
No virus
13.7 kB
import gradio as gr
from typing import List
class Space:
def __init__(self, title, id):
self.title = title
self.id = id
class News:
def __init__(self, title, link):
self.title = title
self.link = link
class Category:
def __init__(self, title, description, news: List[News] = None, spaces=None):
if news is None:
news = []
if spaces is None:
spaces = []
self.title = title
self.description = description
self.news = news
self.spaces = spaces
inclusive = Category(
title="πŸ§‘β€πŸ€β€πŸ§‘ Inclusive",
description="""
These are projects which broaden the scope of who _builds_ and _benefits_ in the machine learning world.
<br><br>
Examples of this can include:
<br><br>
- Curating diverse datasets that increase the representation of underserved groups
- Training language models on languages that aren't yet available on the Hugging Face Hub.
- Creating no-code and low-code frameworks that allow non-technical folk to engage with AI.
""",
news=[
News(
title="πŸš€ Gradio 3.19 - Bugfixes and improved UI/UX for embedded apps",
link="https://twitter.com/Gradio/status/1627702506250805248"
),
News(
title="🧨 Diffusers 0.13 - New pipelines for editing and guiding models",
link="https://twitter.com/multimodalart/status/1627727910801928192"
)
],
spaces=[
Space(
title="Promptist Demo",
id="microsoft/Promptist"
),
Space(
title="MMTAfrica: Multilingual Machine Translation",
id="edaiofficial/mmtafrica"
),
Space(
title="Spanish to Quechua translation",
id="hackathon-pln-es/spanish-to-quechua-translation"
),
]
)
rigorous = Category(
title="✍️ Rigorous",
description="""
Among the many concerns that go into creating new models is a seemingly simple question: "Does it work?"
<br><br>
Rigorous projects pay special attention to examining failure cases, protecting privacy through security measures, and ensuring that potential users (technical and non-technical) are informed of the project's limitations.
<br><br>
Examples:
<br><br>
- Projects built with models that are well-documented with Model Cards.
- Tools that provide transparency into how a model was trained and how it behaves.
- Evaluations against cutting-edge benchmarks, with results reported against disaggregated sets.
- Demonstrations of models failing across gender, skin type, ethnicity, age or other attributes.
- Techniques for mitigating issues like over-fitting and training data memorization.
""",
news=[
News(
title="πŸ—žοΈ AI chatbots are coming to search engines β€” can you trust the results?",
link="https://www.nature.com/articles/d41586-023-00423-4"
),
News(
title="πŸ“‘ Model Cards: Introducing new documentation tools",
link="https://huggingface.co/blog/model-cards"
),
News(
title="πŸ€— Ethics & Society Newsletter #2: Let's talk about bias!",
link="https://huggingface.co/blog/ethics-soc-2"
)
],
spaces=[
Space(
title="A Watermark for Large Language Models",
id="tomg-group-umd/lm-watermarking"
),
Space(
title="Roots Search Tool",
id="bigscience-data/roots-search"
),
Space(
title="Diffusion Bias Explorer",
id="society-ethics/DiffusionBiasExplorer"
),
Space(
title="Disaggregators",
id="society-ethics/disaggregators"
)
]
)
socially_conscious = Category(
title="πŸ‘οΈβ€πŸ—¨οΈ Socially Conscious",
description="""
Socially Conscious work shows us how machine learning can support efforts toward a stronger society!
<br><br>
Examples:
<br><br>
- Using machine learning as part of an effort to tackle climate change.
- Building tools to assist with medical research and practice.
- Models for text-to-speech, image captioning, and other tasks aimed at increasing accessibility.
- Creating systems for the digital humanities, such as for Indigenous language revitalization.
""",
news=[
News(
title="πŸ¦“ New dataset: LILA Camera Traps",
link="https://huggingface.co/datasets/society-ethics/lila_camera_traps"
),
News(
title="πŸ§‘β€πŸ”¬ Deep Learning With Proteins",
link="https://huggingface.co/blog/deep-learning-with-proteins"
)
],
spaces=[
Space(
title="Comparing Captioning Models",
id="nielsr/comparing-captioning-models"
),
Space(
title="Whisper Speaker Diarization",
id="vumichien/whisper-speaker-diarization"
),
Space(
title="Speech Recognition from visual lip movement",
id="vumichien/lip_movement_reading"
),
Space(
title="Socratic Models Image Captioning",
id="Geonmo/socratic-models-image-captioning-with-BLOOM"
),
]
)
consentful = Category(
title="🀝 Consentful",
description="""
[What is consentful tech?](https://www.consentfultech.io)
Consentful technology supports the self-determination of people who use and are affected by these technologies.
<br><br>
Examples of this can include:
<br><br>
- Demonstrating a commitment to acquiring data from willing, informed, and appropriately compensated sources.
- Designing systems that respect end-user autonomy, e.g. with privacy-preserving techniques.
- Avoiding extractive, chauvinist, ["dark"](https://www.deceptive.design), and otherwise "unethical" patterns of engagement.
""",
news=[
News(
title="πŸŽ₯ MoroccoAI webinar - Loubna Ben Allal - 'Building open large models for code'",
link="https://twitter.com/MoroccoAI/status/1629105224848646144"
),
News(
title="The Stack - 3 TB of Permissively Licensed Source Code",
link="https://www.bigcode-project.org/docs/about/the-stack/"
)
],
spaces=[
Space(
title="Sentiment Analysis on Encrypted Data with FHE",
id="zama-fhe/encrypted_sentiment_analysis"
),
Space(
title="SantaCoder: Code Generation",
id="bigcode/santacoder-demo"
),
Space(
title="Data Anonymization in Autonomous Driving",
id="khaclinh/self-driving-anonymization"
),
Space(
title="Raising the Cost of Malicious AI-Powered Image Editing",
id="RamAnanth1/photoguard"
),
]
)
sustainable = Category(
title="🌎 Sustainable",
description="""
This is work that highlights and explores techniques for making machine learning ecologically sustainable.
<br><br>
Examples
<br><br>
- Tracking emissions from training and running inferences on large language models.
- Quantization and distillation methods to reduce carbon footprints without sacrificing model quality.
""",
news=[
News(
title="πŸ”” New paper: Counting Carbon – Luccioni & Hernandez-Garcia, 2023",
link="https://twitter.com/SashaMTL/status/1626572394130292737"
),
News(
title="PEFT: Parameter-Efficient Fine-Tuning on Low-Resource Hardware",
link="https://huggingface.co/blog/peft"
)
],
spaces=[
Space(
title="Hugging Face Carbon Compare Tool",
id="huggingface/Carbon-Compare"
),
Space(
title="Image Classification with EfficientFormer-L1",
id="adirik/efficientformer"
),
Space(
title="EfficientNetV2 Deepfakes Video Detector",
id="Ron0420/EfficientNetV2_Deepfakes_Video_Detector"
),
]
)
inquisitive = Category(
title="πŸ€” Inquisitive",
description="""
Some projects take a radical new approach to concepts which may have become commonplace. These projects, often rooted in critical theory, shine a light on inequities and power structures which challenge the community to rethink its relationship to technology.
<br><br>
Examples:
<br><br>
- Reframing AI and machine learning from Indigenous perspectives.
- Highlighting LGBTQIA2S+ marginalization in AI.
- Critiquing the harms perpetuated by AI systems.
- Discussing the role of "openness" in AI research.
""",
news=[
News(
title="πŸŽ™οΈ NPR: Know It All: What Is AI And How Will It Shape The Future?",
link="https://www.npr.org/2023/02/20/1158300530/know-it-all-what-is-ai-and-how-will-it-shape-the-future"
),
News(
title="🦜 DAIR's Stochastic Parrots Day is on March 17",
link="https://twitter.com/emilymbender/status/1627312284392640513"
),
News(
title="🌈 New paper: The Gradient of Generative AI Release – Solaiman, 2023",
link="https://twitter.com/IreneSolaiman/status/1625158317378252800"
),
News(
title="βš–οΈ Diffusers has a brand new Ethical Guidelines doc!",
link="https://github.com/huggingface/diffusers/pull/2330"
)
],
spaces=[
Space(
title="Spanish Gender Neutralizer",
id="hackathon-pln-es/es_nlp_gender_neutralizer"
),
Space(
title="PAIR: Datasets Have Worldviews",
id="merve/dataset-worldviews"
),
]
)
categories = [rigorous, consentful, socially_conscious, sustainable, inclusive, inquisitive]
def news_card(news):
with gr.Box():
with gr.Row(elem_id="news-row"):
gr.Markdown(f"{news.title}")
button = gr.Button(elem_id="article-button", value="Read more πŸ”—")
button.click(fn=None, _js=f"() => window.open('{news.link}')")
def space_card(space):
with gr.Box(elem_id="space-card"):
with gr.Row(elem_id="news-row"):
gr.Markdown(f"{space.title}")
button = gr.Button(elem_id="article-button", value="View πŸ”­")
button.click(fn=None, _js=f"() => window.open('https://hf.space/{space.id}')")
def category_tab(category):
with gr.Tab(label=category.title, elem_id="news-tab"):
with gr.Row():
with gr.Column():
gr.Markdown(category.description, elem_id="margin-top")
with gr.Column():
gr.Markdown("### Hugging Face News πŸ“°")
[news_card(x) for x in category.news]
# with gr.Tab(label="Hugging Face Projects"):
# gr.Markdown("....")
with gr.Tab(label="Spaces"):
with gr.Row(elem_id="spaces-flex"):
[space_card(x) for x in category.spaces]
with gr.Tab(label="Models - Coming Soon!"):
gr.Markdown(elem_id="margin-top", value="#### Check back soon for featured models πŸ€—")
with gr.Tab(label="Datasets - Coming Soon!"):
gr.Markdown(elem_id="margin-top", value="#### Check back soon for featured datasets πŸ€—")
with gr.Blocks(css="#margin-top {margin-top: 15px} #center {text-align: center;} #news-tab {padding: 15px;} #news-tab h3 {margin: 0px; text-align: center;} #news-tab p {margin: 0px;} #article-button {flex-grow: initial;} #news-row {align-items: center;} #spaces-flex {flex-wrap: wrap;} #space-card { display: flex; min-width: calc(90% / 3); max-width:calc(100% / 3); box-sizing: border-box;}") as demo:
with gr.Row(elem_id="center"):
gr.Markdown("# Ethics & Society at Hugging Face")
gr.Markdown("""
At Hugging Face, we are committed to operationalizing ethics at the cutting-edge of machine learning. This page is dedicated to highlighting projects – inside and outside Hugging Face – in order to encourage and support more ethical development and use of AI. We wish to foster ongoing conversations of ethics and values; this means that this page will evolve over time, and your feedback is invaluable. Please open up an issue in the [Community tab](https://huggingface.co/spaces/society-ethics/about/discussions) to share your thoughts!
""")
with gr.Accordion(label="Want to learn more? Visit us over on the Hugging Face Discord!", open=False):
gr.Markdown("""
Follow these steps to join the discussion:
1. Go to [hf.co/join/discord](https://hf.co/join/discord) to join the Discord server.
2. Once you've registered, go to the `#role-assignment` channel.
3. Select the "Open Science" role.
4. Head over to `#ethics-and-society` to join the conversation πŸ₯³
""", elem_id="margin-top")
gr.Markdown("""
### What does ethical AI look like?
We analyzed the submissions on Hugging Face Spaces and put together a set of 6 high-level categories for describing ethical aspects of machine learning work. Visit each tab to learn more about each category and to see what Hugging Face and its community have been up to! Is there a Space that you'd like to see featured? [Submit it here πŸš€](https://huggingface.co/spaces/society-ethics/featured-spaces-submissions)
""")
with gr.Column():
[category_tab(x) for x in categories]
demo.launch()