merve HF Staff commited on
Commit
cde5b52
·
1 Parent(s): f73707b

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +233 -0
app.py ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from typing import List
3
+ from datasets import load_dataset
4
+
5
+
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
+
34
+ client_side = Category(
35
+ category_id="client_side",
36
+ title="Client Side Libraries 🤝",
37
+ description="""
38
+ These are client side libraries to easily interact or run training with models, datasets and Spaces on Hugging Face Hub
39
+ <br><br>
40
+ """,
41
+ news=[
42
+ News(
43
+ title="We have launched huggingface.js to let developers interact with models on Hub in an API-like manner🚀",
44
+ link="https://github.com/huggingface/huggingface.js"
45
+ ),
46
+ News(
47
+ title="Xenova released transformers.js, to let you run powerful transformers easily inside browsers 🦾",
48
+ link="https://github.com/xenova/transformers.js"
49
+ ),
50
+ News(
51
+ title="Elixir 🤝 Hugging Face with Bumblebee",
52
+ link="https://news.livebook.dev/announcing-bumblebee-gpt2-stable-diffusion-and-more-in-elixir-3Op73O"
53
+ )
54
+ ],
55
+ )
56
+ documentation = Category(
57
+ category_id="documentation",
58
+ title="Documentation 📚",
59
+ description="""
60
+ These are our documentation efforts and blogs specifically targeted for software developers to get them started with building machine learning 🦾
61
+ <br><br>
62
+ """,
63
+ news=[
64
+ News(
65
+ title="Tasks: Wikipedia of machine learning to easily find the model you need for your use case and get started with building! 📚 ",
66
+ link="https://www.technologyreview.com/2023/03/22/1070167/these-news-tool-let-you-see-for-yourself-how-biased-ai-image-models-are/"
67
+ ),
68
+ News(
69
+ title="huggingface.js Documentation",
70
+ link="https://www.wired.com/story/welfare-state-algorithms/"
71
+ ),
72
+ News(
73
+ title="From GPT2 to Stable Diffusion: Hugging Face arrives to the Elixir community",
74
+ link="https://huggingface.co/blog/elixir-bumblebee"
75
+ ),
76
+ News(
77
+ title="Swift 🧨Diffusers: Fast Stable Diffusion for Mac",
78
+ link="https://huggingface.co/blog/fast-mac-diffusers"
79
+ ),
80
+ News(
81
+ title="Using Stable Diffusion with Core ML on Apple Silicon",
82
+ link="https://huggingface.co/blog/diffusers-coreml"
83
+ ),
84
+ News(
85
+ title="Tutorial: How Hugging Face achieved a 2x performance boost for Question Answering with DistilBERT in Node.js",
86
+ link="https://blog.tensorflow.org/2020/05/how-hugging-face-achieved-2x-performance-boost-question-answering.html"
87
+ )
88
+ ],
89
+ )
90
+ use_cases = Category(
91
+ category_id="use_cases",
92
+ title="Use Cases",
93
+ description="""
94
+ These are resources compiled to demonstrate various use cases across different niches in software development.
95
+ <br><br>
96
+ """,
97
+ news=[
98
+ News(
99
+ title="AI for Game Development: Creating a Farming Game in 5 Days. Part 1",
100
+ link="https://huggingface.co/blog/ml-for-games-1"
101
+ ),
102
+ News(
103
+ title="AI for Game Development: Creating a Farming Game in 5 Days. Part 2",
104
+ link="https://huggingface.co/blog/ml-for-games-2"
105
+ ),
106
+ News(
107
+ title="3D Asset Generation: AI for Game Development #3",
108
+ link="https://huggingface.co/blog/ml-for-games-3"
109
+ ),
110
+ News(
111
+ title="Supercharged Customer Service with Machine Learning",
112
+ link="https://huggingface.co/blog/supercharge-customer-service-with-machine-learning"
113
+ )
114
+ ],
115
+ )
116
+ cloud = Category(
117
+ category_id="cloud",
118
+ title="☁️ Cloud Deployment",
119
+ description="""
120
+ This category includes resources on how to deploy machine learning models to cloud using various providers ☁️
121
+ <br><br>
122
+ """,
123
+ news=[
124
+ News(
125
+ title="Deploying 🤗 ViT on Kubernetes with TF Serving",
126
+ link="https://huggingface.co/blog/deploy-tfserving-kubernetes"
127
+ ),
128
+ News(
129
+ title="An Overview of Inference Solutions on Hugging Face",
130
+ link="https://huggingface.co/blog/inference-update"
131
+ ),
132
+ News(
133
+ title="Hugging Face Collaborates with Microsoft to Launch Hugging Face Endpoints on Azure",
134
+ link="https://huggingface.co/blog/hugging-face-endpoints-on-azure"
135
+ ),
136
+ News(
137
+ title="Workshop: Getting started with Amazon Sagemaker Train a Hugging Face Transformers and deploy it",
138
+ link="https://www.youtube.com/watch?v=80ix-IyNnQI&ab_channel=AmazonWebServices"
139
+ ),
140
+ News(
141
+ title="Getting Started with Hugging Face on AWS: Series of video tutorials",
142
+ link="https://www.youtube.com/watch?v=80ix-IyNnQI&ab_channel=AmazonWebServices"
143
+ ),
144
+ ],
145
+ )
146
+
147
+
148
+ categories = [client_side, documentation, cloud, use_cases]
149
+
150
+
151
+ def news_card(news):
152
+ with gr.Box():
153
+ with gr.Row(elem_id="news-row"):
154
+ gr.Markdown(f"{news.title}")
155
+ button = gr.Button(elem_id="article-button", value="Read more 🔗")
156
+ button.click(fn=None, _js=f"() => window.open('{news.link}')")
157
+
158
+
159
+ def space_card(space):
160
+ with gr.Box(elem_id="space-card"):
161
+ with gr.Row(elem_id="news-row"):
162
+ gr.Markdown(f"{space.title}")
163
+ button = gr.Button(elem_id="article-button", value="View 🔭")
164
+ button.click(fn=None, _js=f"() => window.open('https://hf.space/{space.id}')")
165
+
166
+
167
+ def category_tab(category):
168
+ with gr.Tab(label=category.title, elem_id="news-tab"):
169
+ with gr.Row():
170
+ with gr.Column():
171
+ gr.Markdown(category.description, elem_id="margin-top")
172
+ with gr.Column():
173
+ gr.Markdown("### Hugging Face News 📰")
174
+ [news_card(x) for x in category.news]
175
+ # with gr.Tab(label="Hugging Face Projects"):
176
+ # gr.Markdown("....")
177
+ with gr.Tab(label="Spaces"):
178
+ with gr.Row(elem_id="spaces-flex"):
179
+ [space_card(x) for x in category.spaces]
180
+ with gr.Tab(label="🤗 Hugging Face Papers"):
181
+ with gr.Row(elem_id="spaces-flex"):
182
+ [paper_tile(p) for p in papers.filter(lambda p: category.category_id in p["tags"])]
183
+ with gr.Tab(label="Models - Coming Soon!"):
184
+ gr.Markdown(elem_id="margin-top", value="#### Check back soon for featured models 🤗")
185
+ with gr.Tab(label="Datasets - Coming Soon!"):
186
+ gr.Markdown(elem_id="margin-top", value="#### Check back soon for featured datasets 🤗")
187
+
188
+
189
+ 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:
190
+ with gr.Row(elem_id="center"):
191
+ gr.Markdown("# Hugging Face for Software Developers")
192
+
193
+ gr.Markdown("""
194
+ At Hugging Face, we are committed to democratize the cutting-edge of machine learning for everyone. This page is dedicated to highlighting tools, documentation and projects – inside and outside Hugging Face – tailored to get software developers build with machine learning.
195
+ """)
196
+
197
+ with gr.Accordion(label="Events", open=False):
198
+ with gr.Tab(label="Upcoming Events"):
199
+ with gr.Row(elem_id="margin-top"):
200
+ gr.Markdown("We'll be announcing more events soon!")
201
+
202
+ with gr.Tab(label="Past Events"):
203
+ with gr.Row(elem_id="margin-top"):
204
+ with gr.Column(scale=1):
205
+ gr.Image(value="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/making-intelligence-banner.png", show_label=False)
206
+ with gr.Column(scale=2):
207
+ with gr.Tabs(elem_id="event-tabs"):
208
+ with gr.Tab("About the Event"):
209
+ gr.Markdown("""
210
+ We have done a series of workshops for building, deploying and scaling models using AWS SageMaker.
211
+ You can rewatch them [here](https://www.youtube.com/watch?v=pYqjCzoyWyo&ab_channel=HuggingFace).
212
+ **Date:** October 26 2021 **Location:** YouTube
213
+ """)
214
+
215
+ with gr.Accordion(label="Visit us over on the Hugging Face Discord!", open=False):
216
+ gr.Markdown("""
217
+ Follow these steps to join the discussion:
218
+
219
+ 1. Go to [hf.co/join/discord](https://hf.co/join/discord) to join the Discord server.
220
+ 2. Once you've registered, go to the `#role-assignment` channel.
221
+ 3. Select the categories of your interest. Open Source ML is one that has different areas of machine learning.
222
+ """, elem_id="margin-top")
223
+
224
+ gr.Markdown("""
225
+ ### What can you achieve as a developer using Machine Learning?
226
+
227
+ Following are different categories of interests that include tools and documentation for software developers.
228
+ """)
229
+
230
+ with gr.Column():
231
+ [category_tab(x) for x in categories]
232
+
233
+ demo.launch()