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.

Examples of this can include:

- 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?"

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.

Examples:

- 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 be applied as a force for good!

Examples:

- 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.

Examples of this can include:

- 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="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.

Examples

- 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.

Examples:

- 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="๐Ÿฆœ 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="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("#### Check back soon for featured models ๐Ÿค—") with gr.Tab(label="Datasets - Coming Soon!"): gr.Markdown("#### 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 ethical AI. We wish to have an ongoing conversation when it comes to ethics; 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/docs/hub/repositories-pull-requests-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 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! """) with gr.Column(): [category_tab(x) for x in categories] demo.launch()