Commit
·
b46a92a
1
Parent(s):
e828644
better description
Browse files
app.py
CHANGED
@@ -235,7 +235,7 @@ def open_prs(profile: gr.OAuthProfile | None, user_or_org: str = None):
|
|
235 |
user_to_receive_prs = user_or_org or username
|
236 |
data = get_data_for_user(user_to_receive_prs)
|
237 |
if user_or_org:
|
238 |
-
random.sample(data, min(
|
239 |
if not data:
|
240 |
return "No PRs to open"
|
241 |
results = []
|
@@ -250,10 +250,39 @@ def open_prs(profile: gr.OAuthProfile | None, user_or_org: str = None):
|
|
250 |
return f"Opened {len([r for r in results if r['opened_pr']])} PRs"
|
251 |
|
252 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
with gr.Blocks() as demo:
|
254 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
gr.LoginButton(), gr.LogoutButton()
|
256 |
-
user = gr.Textbox(label="user or org to Open PRs for")
|
257 |
button = gr.Button()
|
258 |
results = gr.Markdown()
|
259 |
button.click(open_prs, [user], results)
|
|
|
235 |
user_to_receive_prs = user_or_org or username
|
236 |
data = get_data_for_user(user_to_receive_prs)
|
237 |
if user_or_org:
|
238 |
+
random.sample(data, min(5, len(data)))
|
239 |
if not data:
|
240 |
return "No PRs to open"
|
241 |
results = []
|
|
|
250 |
return f"Opened {len([r for r in results if r['opened_pr']])} PRs"
|
251 |
|
252 |
|
253 |
+
description_text = """
|
254 |
+
## Welcome to the Librarian Bot Metadata Request Service
|
255 |
+
|
256 |
+
⭐ The Librarian Bot Metadata Request Service allows you to request metadata updates for your models on the Hugging Face Hub. ⭐
|
257 |
+
|
258 |
+
Currently this app allows you to request for librarian bot to add metadata for the `base_model` field, situated in the `YAML` block of your model's `README.md`.
|
259 |
+
|
260 |
+
### How does librarian bot find this information?
|
261 |
+
|
262 |
+
We performed a regular expression match on your `README.md` file to determine the connection.
|
263 |
+
|
264 |
+
### Why add this info to Model Cards?
|
265 |
+
|
266 |
+
Enhancing your model's metadata in this way:
|
267 |
+
- **Boosts Discoverability** - It becomes straightforward to trace the relationships between various models on the Hugging Face Hub.
|
268 |
+
- **Highlights Impact** - It showcases the contributions and influences different models have within the community.
|
269 |
+
|
270 |
+
For a hands-on example of how such metadata can play a pivotal role in mapping model connections, take a look at [librarian-bots/base_model_explorer](https://huggingface.co/spaces/librarian-bots/base_model_explorer).
|
271 |
+
|
272 |
+
This app will allow you to request metadata for all your models or for another user or org. If you request metadata for another user or org, librarian bot will randomly select 5 models to request metadata for.
|
273 |
+
"""
|
274 |
+
|
275 |
+
|
276 |
with gr.Blocks() as demo:
|
277 |
+
gr.HTML(
|
278 |
+
"<h1 style='text-align:center;'><span>🤖</span> Librarian Bot Metadata Request Service <span>🤖</span></h1>"
|
279 |
+
)
|
280 |
+
gr.Markdown(
|
281 |
+
"""<div style='text-align:center;'><img src='https://huggingface.co/spaces/davanstrien/librarian_bot_request_metadata/resolve/main/image.png' style='display:block;margin-left:auto;margin-right:auto;width:150px;'></div><p>"""
|
282 |
+
)
|
283 |
+
gr.Markdown(description_text)
|
284 |
gr.LoginButton(), gr.LogoutButton()
|
285 |
+
user = gr.Textbox(value=None, label="user or org to Open PRs for")
|
286 |
button = gr.Button()
|
287 |
results = gr.Markdown()
|
288 |
button.click(open_prs, [user], results)
|