Simon Strandgaard
commited on
Commit
·
bd55e57
1
Parent(s):
ff3a23b
Only show openrouter models on huggingface spaces
Browse files- src/plan/app_text2plan.py +12 -6
src/plan/app_text2plan.py
CHANGED
@@ -31,15 +31,18 @@ IS_HUGGINGFACE_SPACES = is_huggingface_spaces()
|
|
31 |
@dataclass
|
32 |
class Config:
|
33 |
use_uuid_as_run_id: bool
|
34 |
-
|
|
|
35 |
|
36 |
CONFIG_LOCAL = Config(
|
37 |
use_uuid_as_run_id=False,
|
38 |
-
|
|
|
39 |
)
|
40 |
CONFIG_HUGGINGFACE_SPACES = Config(
|
41 |
use_uuid_as_run_id=True,
|
42 |
-
|
|
|
43 |
)
|
44 |
|
45 |
CONFIG = CONFIG_HUGGINGFACE_SPACES if IS_HUGGINGFACE_SPACES else CONFIG_LOCAL
|
@@ -70,8 +73,11 @@ gradio_examples = []
|
|
70 |
for prompt_item in all_prompts:
|
71 |
gradio_examples.append([prompt_item.prompt])
|
72 |
|
73 |
-
|
74 |
-
|
|
|
|
|
|
|
75 |
|
76 |
def has_pipeline_complete_file(path_dir: str):
|
77 |
"""
|
@@ -380,7 +386,7 @@ with gr.Blocks(title="PlanExe") as demo_text2plan:
|
|
380 |
submit_btn = gr.Button("Submit", variant='primary')
|
381 |
stop_btn = gr.Button("Stop")
|
382 |
retry_btn = gr.Button("Retry")
|
383 |
-
open_dir_btn = gr.Button("Open Output Dir", visible=CONFIG.
|
384 |
|
385 |
output_markdown = gr.Markdown("Output will appear here...")
|
386 |
status_markdown = gr.Markdown("Status messages will appear here...")
|
|
|
31 |
@dataclass
|
32 |
class Config:
|
33 |
use_uuid_as_run_id: bool
|
34 |
+
visible_open_output_dir_button: bool
|
35 |
+
allow_only_openrouter_models: bool
|
36 |
|
37 |
CONFIG_LOCAL = Config(
|
38 |
use_uuid_as_run_id=False,
|
39 |
+
visible_open_output_dir_button=True,
|
40 |
+
allow_only_openrouter_models=False,
|
41 |
)
|
42 |
CONFIG_HUGGINGFACE_SPACES = Config(
|
43 |
use_uuid_as_run_id=True,
|
44 |
+
visible_open_output_dir_button=False,
|
45 |
+
allow_only_openrouter_models=True,
|
46 |
)
|
47 |
|
48 |
CONFIG = CONFIG_HUGGINGFACE_SPACES if IS_HUGGINGFACE_SPACES else CONFIG_LOCAL
|
|
|
73 |
for prompt_item in all_prompts:
|
74 |
gradio_examples.append([prompt_item.prompt])
|
75 |
|
76 |
+
all_available_models = get_available_llms()
|
77 |
+
if CONFIG.allow_only_openrouter_models:
|
78 |
+
available_model_names = [model for model in all_available_models if model.startswith("openrouter")]
|
79 |
+
else:
|
80 |
+
available_model_names = all_available_models
|
81 |
|
82 |
def has_pipeline_complete_file(path_dir: str):
|
83 |
"""
|
|
|
386 |
submit_btn = gr.Button("Submit", variant='primary')
|
387 |
stop_btn = gr.Button("Stop")
|
388 |
retry_btn = gr.Button("Retry")
|
389 |
+
open_dir_btn = gr.Button("Open Output Dir", visible=CONFIG.visible_open_output_dir_button)
|
390 |
|
391 |
output_markdown = gr.Markdown("Output will appear here...")
|
392 |
status_markdown = gr.Markdown("Status messages will appear here...")
|