Update app.py
Browse files
app.py
CHANGED
|
@@ -1,59 +1,10 @@
|
|
| 1 |
-
css = """
|
| 2 |
-
/* Define the background colors for dark and light squares */
|
| 3 |
-
.dark-square {
|
| 4 |
-
background-color: #555;
|
| 5 |
-
}
|
| 6 |
-
|
| 7 |
-
.light-square {
|
| 8 |
-
background-color: #ccc;
|
| 9 |
-
}
|
| 10 |
-
|
| 11 |
-
/* Style the column containers to have the appropriate background color */
|
| 12 |
-
.col {
|
| 13 |
-
flex: 1 0 8.33333%;
|
| 14 |
-
margin: 0 5px;
|
| 15 |
-
text-align: center;
|
| 16 |
-
padding: 10px;
|
| 17 |
-
}
|
| 18 |
-
|
| 19 |
-
/* Alternate the background colors between dark and light squares */
|
| 20 |
-
.layout .col:nth-child(odd) .col:nth-child(odd) {
|
| 21 |
-
background-color: #555;
|
| 22 |
-
}
|
| 23 |
-
|
| 24 |
-
.layout .col:nth-child(even) .col:nth-child(odd) {
|
| 25 |
-
background-color: #ccc;
|
| 26 |
-
}
|
| 27 |
-
|
| 28 |
-
.layout .col:nth-child(odd) .col:nth-child(even) {
|
| 29 |
-
background-color: #ccc;
|
| 30 |
-
}
|
| 31 |
-
|
| 32 |
-
.layout .col:nth-child(even) .col:nth-child(even) {
|
| 33 |
-
background-color: #555;
|
| 34 |
-
}
|
| 35 |
-
"""
|
| 36 |
-
|
| 37 |
# Import necessary libraries
|
| 38 |
import gradio as gr # Gradio is used to create web interfaces for Python scripts.
|
| 39 |
from transformers import AutoConfig # AutoConfig is from the Hugging Face Transformers library, used to create configuration for various models.import gradio as gr
|
| 40 |
|
| 41 |
-
def generate_grid():
|
| 42 |
-
with gr.Blocks(css=css, label="The Big Gridio", elem_class="layout", elem_id="grid-lg") as grid:
|
| 43 |
-
for row in range(12):
|
| 44 |
-
with gr.Row() as row_container:
|
| 45 |
-
for col in range(12):
|
| 46 |
-
with gr.Column() as col_container:
|
| 47 |
-
col_container.style.elem_class = f"col-{col}"
|
| 48 |
-
col_container.style.elem_id = f"col-{col}"
|
| 49 |
-
# Add any additional content or components to the column container here
|
| 50 |
-
gr.Label(f"Row: {row} | Col: {col}")
|
| 51 |
-
|
| 52 |
-
generate_grid()
|
| 53 |
-
|
| 54 |
|
| 55 |
# A list of model names to start with. These are names of popular models from the Hugging Face library.
|
| 56 |
-
model_list = ["bert-base-uncased", "gpt2", "distilbert-base-uncased"]
|
| 57 |
|
| 58 |
# Function to add a new model to the list.
|
| 59 |
def add_model_to_list(new_model):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
# Import necessary libraries
|
| 2 |
import gradio as gr # Gradio is used to create web interfaces for Python scripts.
|
| 3 |
from transformers import AutoConfig # AutoConfig is from the Hugging Face Transformers library, used to create configuration for various models.import gradio as gr
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
# A list of model names to start with. These are names of popular models from the Hugging Face library.
|
| 7 |
+
model_list = ["bert-base-uncased", "gpt2", "distilbert-base-uncased, "]
|
| 8 |
|
| 9 |
# Function to add a new model to the list.
|
| 10 |
def add_model_to_list(new_model):
|