Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ user_info = whoami(token=HF_TOKEN)
|
|
15 |
username = user_info["name"]
|
16 |
from handle_models import load_fn,infer,gen_fn
|
17 |
from externalmod import gr_Interface_load, save_image, randomize_seed
|
18 |
-
|
19 |
#anything but huggingface_hub==0.26.2 will result in token error
|
20 |
#mymodels = list(api.list_models(author=username, token=HF_TOKEN))
|
21 |
#model_ids = [m.modelId for m in mymodels]
|
@@ -33,7 +33,15 @@ default_models = combined_models[:howManyModelsToUse]
|
|
33 |
# return "No models selected."
|
34 |
# return "✅ Selected models:\n" + "\n".join(selected_models)
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
|
39 |
|
|
|
15 |
username = user_info["name"]
|
16 |
from handle_models import load_fn,infer,gen_fn
|
17 |
from externalmod import gr_Interface_load, save_image, randomize_seed
|
18 |
+
|
19 |
#anything but huggingface_hub==0.26.2 will result in token error
|
20 |
#mymodels = list(api.list_models(author=username, token=HF_TOKEN))
|
21 |
#model_ids = [m.modelId for m in mymodels]
|
|
|
33 |
# return "No models selected."
|
34 |
# return "✅ Selected models:\n" + "\n".join(selected_models)
|
35 |
|
36 |
+
def extend_choices(choices):
|
37 |
+
return choices[:num_models] + (num_models - len(choices[:num_models])) * ['NA']
|
38 |
+
def update_imgbox(choices):
|
39 |
+
choices_plus = extend_choices(choices[:num_models])
|
40 |
+
return [gr.Image(None, label=m, visible=(m!='NA')) for m in choices_plus]
|
41 |
+
def random_choices():
|
42 |
+
import random
|
43 |
+
random.seed()
|
44 |
+
return random.choices(models, k=num_models)
|
45 |
|
46 |
|
47 |
|