Spaces:
Running
Running
stripping it down to the booones
Browse files
app.py
CHANGED
|
@@ -1,26 +1,8 @@
|
|
| 1 |
-
# AUTOGENERATED! DO NOT EDIT! File to edit: app.ipynb.
|
| 2 |
-
|
| 3 |
-
# %% auto 0
|
| 4 |
-
__all__ = ['block', 'make_clickable_model', 'make_clickable_user', 'get_submissions']
|
| 5 |
-
|
| 6 |
-
# %% app.ipynb 0
|
| 7 |
import gradio as gr
|
| 8 |
import pandas as pd
|
| 9 |
from huggingface_hub import list_models
|
| 10 |
|
| 11 |
-
# %% app.ipynb 1
|
| 12 |
-
def make_clickable_model(model_name, link=None):
|
| 13 |
-
if link is None:
|
| 14 |
-
link = "https://huggingface.co/" + model_name
|
| 15 |
-
# Remove user from model name
|
| 16 |
-
return f'<a target="_blank" href="{link}">{model_name.split("/")[-1]}</a>'
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
def make_clickable_user(user_id):
|
| 20 |
-
link = "https://huggingface.co/" + user_id
|
| 21 |
-
return f'<a target="_blank" href="{link}">{user_id}</a>'
|
| 22 |
|
| 23 |
-
# %% app.ipynb 2
|
| 24 |
def get_submissions(category):
|
| 25 |
submissions = list_models(filter=["dreambooth-hackathon", category], full=True)
|
| 26 |
leaderboard_models = []
|
|
@@ -42,80 +24,40 @@ def get_submissions(category):
|
|
| 42 |
return df
|
| 43 |
|
| 44 |
# %% app.ipynb 3
|
| 45 |
-
|
| 46 |
|
| 47 |
-
with
|
| 48 |
gr.Markdown(
|
| 49 |
-
"""#
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
This competition is composed of 5 _themes_, where each theme will collect models belong to one of the categories shown in the tabs below. We'll be **giving out prizes to the top 3 most liked models per theme**, and you're encouraged to submit as many models as you want!
|
| 54 |
-
|
| 55 |
-
For details on how to participate, check out the hackathon's guide [here](https://github.com/huggingface/diffusion-models-class/blob/main/hackathon/README.md).
|
| 56 |
-
"""
|
| 57 |
)
|
| 58 |
with gr.Tabs():
|
| 59 |
-
with gr.TabItem("
|
| 60 |
with gr.Row():
|
| 61 |
animal_data = gr.components.Dataframe(
|
| 62 |
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
| 63 |
)
|
| 64 |
-
|
| 65 |
-
data_run = gr.Button("Refresh")
|
| 66 |
-
data_run.click(
|
| 67 |
-
get_submissions, inputs=gr.Variable("animal"), outputs=animal_data
|
| 68 |
-
)
|
| 69 |
-
with gr.TabItem("Science π¬"):
|
| 70 |
with gr.Row():
|
| 71 |
science_data = gr.components.Dataframe(
|
| 72 |
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
| 73 |
)
|
| 74 |
-
|
| 75 |
-
data_run = gr.Button("Refresh")
|
| 76 |
-
data_run.click(
|
| 77 |
-
get_submissions, inputs=gr.Variable("science"), outputs=science_data
|
| 78 |
-
)
|
| 79 |
-
with gr.TabItem("Food π"):
|
| 80 |
with gr.Row():
|
| 81 |
food_data = gr.components.Dataframe(
|
| 82 |
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
| 83 |
)
|
| 84 |
-
|
| 85 |
-
data_run = gr.Button("Refresh")
|
| 86 |
-
data_run.click(
|
| 87 |
-
get_submissions, inputs=gr.Variable("food"), outputs=food_data
|
| 88 |
-
)
|
| 89 |
-
with gr.TabItem("Landscape π"):
|
| 90 |
with gr.Row():
|
| 91 |
landscape_data = gr.components.Dataframe(
|
| 92 |
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
| 93 |
)
|
| 94 |
-
|
| 95 |
-
data_run = gr.Button("Refresh")
|
| 96 |
-
data_run.click(
|
| 97 |
-
get_submissions,
|
| 98 |
-
inputs=gr.Variable("landscape"),
|
| 99 |
-
outputs=landscape_data,
|
| 100 |
-
)
|
| 101 |
-
with gr.TabItem("Wilcard π₯"):
|
| 102 |
with gr.Row():
|
| 103 |
wildcard_data = gr.components.Dataframe(
|
| 104 |
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
| 105 |
)
|
| 106 |
-
with gr.Row():
|
| 107 |
-
data_run = gr.Button("Refresh")
|
| 108 |
-
data_run.click(
|
| 109 |
-
get_submissions,
|
| 110 |
-
inputs=gr.Variable("wildcard"),
|
| 111 |
-
outputs=wildcard_data,
|
| 112 |
-
)
|
| 113 |
-
|
| 114 |
-
block.load(get_submissions, inputs=gr.Variable("animal"), outputs=animal_data)
|
| 115 |
-
block.load(get_submissions, inputs=gr.Variable("science"), outputs=science_data)
|
| 116 |
-
block.load(get_submissions, inputs=gr.Variable("food"), outputs=food_data)
|
| 117 |
-
block.load(get_submissions, inputs=gr.Variable("landscape"), outputs=landscape_data)
|
| 118 |
-
block.load(get_submissions, inputs=gr.Variable("wildcard"), outputs=wildcard_data)
|
| 119 |
|
| 120 |
|
| 121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import pandas as pd
|
| 3 |
from huggingface_hub import list_models
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
|
|
|
| 6 |
def get_submissions(category):
|
| 7 |
submissions = list_models(filter=["dreambooth-hackathon", category], full=True)
|
| 8 |
leaderboard_models = []
|
|
|
|
| 24 |
return df
|
| 25 |
|
| 26 |
# %% app.ipynb 3
|
| 27 |
+
demo = gr.Blocks()
|
| 28 |
|
| 29 |
+
with demo:
|
| 30 |
gr.Markdown(
|
| 31 |
+
"""# Energy Star Leaderboard
|
| 32 |
+
|
| 33 |
+
TODO """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
)
|
| 35 |
with gr.Tabs():
|
| 36 |
+
with gr.TabItem("Text Generation π¬"):
|
| 37 |
with gr.Row():
|
| 38 |
animal_data = gr.components.Dataframe(
|
| 39 |
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
| 40 |
)
|
| 41 |
+
with gr.TabItem("Image Generation π·"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
with gr.Row():
|
| 43 |
science_data = gr.components.Dataframe(
|
| 44 |
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
| 45 |
)
|
| 46 |
+
with gr.TabItem("Text Classification π"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
with gr.Row():
|
| 48 |
food_data = gr.components.Dataframe(
|
| 49 |
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
| 50 |
)
|
| 51 |
+
with gr.TabItem("Image Classification πΌοΈ"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
with gr.Row():
|
| 53 |
landscape_data = gr.components.Dataframe(
|
| 54 |
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
| 55 |
)
|
| 56 |
+
with gr.TabItem("Extractive QA β"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
with gr.Row():
|
| 58 |
wildcard_data = gr.components.Dataframe(
|
| 59 |
type="pandas", datatype=["number", "markdown", "markdown", "number"]
|
| 60 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
+
demo.launch()
|