Spaces:
Runtime error
Runtime error
change style to collapsible
Browse files
app.py
CHANGED
@@ -48,10 +48,6 @@ INIT_MARKDOWN = """
|
|
48 |
|
49 |
|
50 |
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
👈 Fill in as much data as you can...
|
56 |
|
57 |
|
@@ -60,10 +56,6 @@ INIT_MARKDOWN = """
|
|
60 |
|
61 |
|
62 |
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
👈 ... then click here!
|
68 |
"""
|
69 |
|
@@ -76,7 +68,7 @@ Here is a list of suggestions for you:
|
|
76 |
"""
|
77 |
|
78 |
TASK_MODEL_MISMATCH = """
|
79 |
-
<details><summary>Select a better model for your task</summary>
|
80 |
|
81 |
The selected model ({model_name}) is not appropriate for the task you selected {task_type}).
|
82 |
</details>
|
@@ -103,11 +95,14 @@ def get_suggestions(task_type, model_name, problem_type):
|
|
103 |
# Check if the inputs were given
|
104 |
if task_type == "" and model_name == "" and problem_type == "":
|
105 |
return INIT_MARKDOWN
|
|
|
106 |
suggestions = SUGGETIONS_HEADER
|
|
|
107 |
|
108 |
# Check if the model is valid for the task. If not, return straight away
|
109 |
if not is_valid_task_for_model(model_name, task_type):
|
110 |
-
|
|
|
111 |
return suggestions
|
112 |
|
113 |
# Demo shortcut: only a few sections are working
|
@@ -135,19 +130,19 @@ with demo:
|
|
135 |
with gr.Row():
|
136 |
with gr.Column():
|
137 |
problem_type = gr.Dropdown(
|
138 |
-
label="What would you like to improve?
|
139 |
choices=[""] + list(PROBLEMS.keys()),
|
140 |
interactive=True,
|
141 |
value="",
|
142 |
)
|
143 |
task_type = gr.Dropdown(
|
144 |
-
label="What
|
145 |
choices=[""] + list(TASK_TYPES.keys()),
|
146 |
interactive=True,
|
147 |
value="",
|
148 |
)
|
149 |
model_name = gr.Textbox(
|
150 |
-
label="Which model are you using?
|
151 |
placeholder="e.g. google/flan-t5-xl",
|
152 |
interactive=True,
|
153 |
)
|
|
|
48 |
|
49 |
|
50 |
|
|
|
|
|
|
|
|
|
51 |
👈 Fill in as much data as you can...
|
52 |
|
53 |
|
|
|
56 |
|
57 |
|
58 |
|
|
|
|
|
|
|
|
|
59 |
👈 ... then click here!
|
60 |
"""
|
61 |
|
|
|
68 |
"""
|
69 |
|
70 |
TASK_MODEL_MISMATCH = """
|
71 |
+
<details><summary>{count}. Select a better model for your task</summary>
|
72 |
|
73 |
The selected model ({model_name}) is not appropriate for the task you selected {task_type}).
|
74 |
</details>
|
|
|
95 |
# Check if the inputs were given
|
96 |
if task_type == "" and model_name == "" and problem_type == "":
|
97 |
return INIT_MARKDOWN
|
98 |
+
|
99 |
suggestions = SUGGETIONS_HEADER
|
100 |
+
counter = 0
|
101 |
|
102 |
# Check if the model is valid for the task. If not, return straight away
|
103 |
if not is_valid_task_for_model(model_name, task_type):
|
104 |
+
counter += 1
|
105 |
+
suggestions += TASK_MODEL_MISMATCH.format(count=counter, model_name=model_name, task_type=task_type)
|
106 |
return suggestions
|
107 |
|
108 |
# Demo shortcut: only a few sections are working
|
|
|
130 |
with gr.Row():
|
131 |
with gr.Column():
|
132 |
problem_type = gr.Dropdown(
|
133 |
+
label="What would you like to improve?",
|
134 |
choices=[""] + list(PROBLEMS.keys()),
|
135 |
interactive=True,
|
136 |
value="",
|
137 |
)
|
138 |
task_type = gr.Dropdown(
|
139 |
+
label="What task are you working on?",
|
140 |
choices=[""] + list(TASK_TYPES.keys()),
|
141 |
interactive=True,
|
142 |
value="",
|
143 |
)
|
144 |
model_name = gr.Textbox(
|
145 |
+
label="Which model are you using?",
|
146 |
placeholder="e.g. google/flan-t5-xl",
|
147 |
interactive=True,
|
148 |
)
|