Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -133,7 +133,7 @@ demo = gr.ChatInterface(
|
|
| 133 |
),
|
| 134 |
gr.Slider(
|
| 135 |
minimum=-1,
|
| 136 |
-
maximum=65535,
|
| 137 |
value=-1,
|
| 138 |
step=1,
|
| 139 |
label="Seed (-1 for random)"
|
|
@@ -150,6 +150,51 @@ demo = gr.ChatInterface(
|
|
| 150 |
)
|
| 151 |
print("Gradio interface initialized.")
|
| 152 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
if __name__ == "__main__":
|
| 154 |
print("Launching the demo application.")
|
| 155 |
demo.launch()
|
|
|
|
| 133 |
),
|
| 134 |
gr.Slider(
|
| 135 |
minimum=-1,
|
| 136 |
+
maximum=65535,
|
| 137 |
value=-1,
|
| 138 |
step=1,
|
| 139 |
label="Seed (-1 for random)"
|
|
|
|
| 150 |
)
|
| 151 |
print("Gradio interface initialized.")
|
| 152 |
|
| 153 |
+
# --------------------------------------------------------
|
| 154 |
+
# NEW FEATURE: "Featured Models" Accordion with Filtering
|
| 155 |
+
# Adapted from Serverless-ImgGen-Hub's approach
|
| 156 |
+
# --------------------------------------------------------
|
| 157 |
+
with demo:
|
| 158 |
+
with gr.Accordion("Featured Models", open=False):
|
| 159 |
+
# Textbox to search/filter models
|
| 160 |
+
model_search = gr.Textbox(
|
| 161 |
+
label="Filter Models",
|
| 162 |
+
placeholder="Search for a featured model...",
|
| 163 |
+
lines=1
|
| 164 |
+
)
|
| 165 |
+
|
| 166 |
+
# For demonstration purposes, here is a sample list of possible text-generation models
|
| 167 |
+
models_list = [
|
| 168 |
+
"meta-llama/Llama-3.3-70B-Instruct",
|
| 169 |
+
"bigscience/bloomz-7b1",
|
| 170 |
+
"OpenAssistant/oasst-sft-1-pythia-12b",
|
| 171 |
+
"OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5",
|
| 172 |
+
"tiiuae/falcon-7b-instruct",
|
| 173 |
+
"OpenAI/gpt-3.5-turbo",
|
| 174 |
+
"OpenAI/gpt-4-32k",
|
| 175 |
+
"meta-llama/Llama-2-13B-chat-hf",
|
| 176 |
+
"meta-llama/Llama-2-70B-chat-hf",
|
| 177 |
+
]
|
| 178 |
+
|
| 179 |
+
# Radio buttons to display and select from the featured models
|
| 180 |
+
# This won't directly override the "Custom Model" field, but you can copy it from here
|
| 181 |
+
featured_model = gr.Radio(
|
| 182 |
+
label="Select a model below",
|
| 183 |
+
choices=models_list,
|
| 184 |
+
value="meta-llama/Llama-3.3-70B-Instruct",
|
| 185 |
+
interactive=True
|
| 186 |
+
)
|
| 187 |
+
|
| 188 |
+
# Filtering function to update model list based on search input
|
| 189 |
+
def filter_models(search_term):
|
| 190 |
+
# Filter the list by checking if the search term is in each model name
|
| 191 |
+
filtered = [m for m in models_list if search_term.lower() in m.lower()]
|
| 192 |
+
return gr.update(choices=filtered)
|
| 193 |
+
|
| 194 |
+
# When the user types in the search box, we update the featured_model radio choices
|
| 195 |
+
model_search.change(filter_models, inputs=model_search, outputs=featured_model)
|
| 196 |
+
|
| 197 |
+
|
| 198 |
if __name__ == "__main__":
|
| 199 |
print("Launching the demo application.")
|
| 200 |
demo.launch()
|