fdaudens HF Staff commited on
Commit
5b0fa5b
Β·
verified Β·
1 Parent(s): dc26a0d

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -153
app.py DELETED
@@ -1,153 +0,0 @@
1
- # This page is based on work by Meg Mitchell from https://huggingface.co/spaces/society-ethics/about
2
-
3
- import gradio as gr
4
- from typing import List
5
- from datasets import load_dataset
6
-
7
- class Space:
8
- def __init__(self, title, id):
9
- self.title = title
10
- self.id = id
11
-
12
-
13
- class News:
14
- def __init__(self, title, link):
15
- self.title = title
16
- self.link = link
17
-
18
-
19
- class Category:
20
- def __init__(self, category_id, title, description, news: List[News] = None, spaces=None):
21
- if news is None:
22
- news = []
23
-
24
- if spaces is None:
25
- spaces = []
26
-
27
- self.category_id = category_id
28
- self.title = title
29
- self.description = description
30
- self.news = news
31
- self.spaces = spaces
32
-
33
- assistants = Category(
34
- category_id="assistants",
35
- title="πŸ€— Assistants",
36
- description="""
37
- Assistants are a great way to configure models to perform specific tasks. We provide two helpful examples for journalists:
38
- <br><br>
39
- + [SEO Assistant - Optimize your content for search engines](https://hf.co/chat/assistant/66227594635ce17e1b021daf)
40
- + [Tweet Generator - Instantly create engaging tweets with AI!](https://hf.co/chat/assistant/6625a823c4d7e049ca331a3c)
41
- <br><br>
42
- The prompts behind them are public, feel free to tailor them for your needs. Also, share your ideas for other Assistants in the Community tab!
43
- """
44
- )
45
-
46
- elections = Category(
47
- category_id="elections",
48
- title="πŸ—³οΈ Elections Guide",
49
- description="""
50
- Coming soon
51
- """,
52
- news=[
53
- News(
54
- title="AI Watermarking Is Not Going to Save Us",
55
- link="https://www.proofnews.org/ai-watermarking-is-not-going-to-save-us/"
56
- )
57
- ]
58
- )
59
-
60
- resources = Category(
61
- category_id="resources",
62
- title="πŸ› οΈ Resources",
63
- description="""
64
- + [Open Source Models with Hugging Face](https://www.deeplearning.ai/short-courses/open-source-models-hugging-face/) - In this course from DeepLearning.AI & πŸ€—, you’ll select open source models from Hugging Face Hub to perform NLP, audio, image and multimodal tasks using the Hugging Face transformers library. Easily package your code into a user-friendly app that you can run on the cloud using Gradio and Hugging Face Spaces.
65
- + [πŸ€— NLP Course](https://huggingface.co/learn/nlp-course/chapter1/1) - This course will teach you about natural language processing (NLP) using libraries from the Hugging Face ecosystem β€” πŸ€— Transformers, πŸ€— Datasets, πŸ€— Tokenizers, and πŸ€— Accelerate β€” as well as the Hugging Face Hub. It’s completely free and without ads. A good starting point for journalists with a good knowledge of Python.
66
- + [πŸ€— Audio Course](https://huggingface.co/learn/audio-course) - Learn to apply transformers to audio data using libraries from the HF ecosystem.
67
- + [πŸ€— Community Computer Vision Course](https://huggingface.co/learn/computer-vision-course/unit0/welcome/welcome) - This course will teach you about computer vision ML using libraries and models from the HF ecosystem.
68
- + [πŸ€— Deep RL Course](https://huggingface.co/learn/deep-rl-course) - This course will teach you about deep reinforcement learning using libraries from the HF ecosystem.
69
- + [πŸ€— Diffusion Models Course](https://huggingface.co/learn/diffusion-course/unit0/1) - Learn about diffusion models & how to use them with diffusers.
70
- + [Open-Source AI Cookbook](https://huggingface.co/learn/cookbook/index) - A collection of notebooks illustrating practical aspects of building AI applications and solving various machine learning tasks using open-source tools and models.
71
- + [Ethics & Society at πŸ€—](https://huggingface.co/spaces/society-ethics/about)
72
- <br><br>
73
- More resources coming soon
74
- """
75
- )
76
-
77
- experts = Category(
78
- category_id="experts",
79
- title="☎️ Experts Guide",
80
- description="""
81
- Coming soon
82
- """
83
- )
84
-
85
- categories = [assistants, elections, resources, experts]
86
-
87
-
88
- def news_card(news):
89
- with gr.Box():
90
- with gr.Row(elem_id="news-row"):
91
- gr.Markdown(f"{news.title}")
92
- button = gr.Button(elem_id="article-button", value="Read more πŸ”—")
93
- button.click(fn=None, _js=f"() => window.open('{news.link}')")
94
-
95
-
96
- def space_card(space):
97
- with gr.Box(elem_id="space-card"):
98
- with gr.Row(elem_id="news-row"):
99
- gr.Markdown(f"{space.title}")
100
- button = gr.Button(elem_id="article-button", value="View πŸ”­")
101
- button.click(fn=None, _js=f"() => window.open('https://hf.space/{space.id}')")
102
-
103
-
104
- def category_tab(category):
105
- with gr.Tab(label=category.title, elem_id="news-tab"):
106
- with gr.Row():
107
- with gr.Column():
108
- gr.Markdown(category.description, elem_id="margin-top")
109
- with gr.Column():
110
- gr.Markdown("### Hugging Face News πŸ“°")
111
- [news_card(x) for x in category.news]
112
- # with gr.Tab(label="Hugging Face Projects"):
113
- # gr.Markdown("....")
114
- with gr.Tab(label="Spaces"):
115
- with gr.Row(elem_id="spaces-flex"):
116
- [space_card(x) for x in category.spaces]
117
- with gr.Tab(label="πŸ€— Hugging Face Papers"):
118
- with gr.Row(elem_id="spaces-flex"):
119
- [paper_tile(p) for p in papers.filter(lambda p: category.category_id in p["tags"])]
120
- # with gr.Tab(label="Models - Coming Soon!"):
121
- # gr.Markdown(elem_id="margin-top", value="#### Check back soon for featured models πŸ€—")
122
- # with gr.Tab(label="Datasets - Coming Soon!"):
123
- # gr.Markdown(elem_id="margin-top", value="#### Check back soon for featured datasets πŸ€—")
124
-
125
-
126
- 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; justify-content: space-around;} #space-card { display: flex; min-width: calc(90% / 3); max-width:calc(100% / 3); box-sizing: border-box;} #event-tabs {margin-top: 0px;} #spaces-flex > #paper-tile {min-width: 30%; max-width: 30%;}") as demo:
127
- with gr.Row(elem_id="center"):
128
- gr.Markdown("# Ethics & Society at Hugging Face")
129
-
130
- gr.Markdown("""
131
- Welcome to Journalists on Hugging Face, a community exploring the intersection of journalism and AI in the spirit of openness and collaboration. Here, we aim to share knowledge, tools, models, datasets, and projects to help news professionals discover useful resources to inform their reporting on or with the technology. Join us (by tapping the button in the top right πŸ˜‰) in shaping the future of journalism and AIβ€”share your projects, ask questions, and provide feedback by opening an issue in the Community tab!
132
- """)
133
-
134
- with gr.Accordion(label="Drop us a line!", open=False):
135
- gr.Markdown("""
136
- We're passionate about what AI can do for journalism. Join us online to continue the conversation:
137
- + Florent Daudens
138
- ++ [Twitter](https://twitter.com/fdaudens)
139
- ++ [LinkedIn]()
140
-
141
- + Brigitte Tousignant
142
- ++ [Twitter](https://twitter.com/BrigitteTousi)
143
- ++ [LinkedIn](https://www.linkedin.com/in/brigitte-tousignant/)
144
- """, elem_id="margin-top")
145
-
146
- # gr.Markdown("""
147
- # ### NEW
148
- #""")
149
-
150
- with gr.Column():
151
- [category_tab(x) for x in categories]
152
-
153
- demo.launch()