joaogante HF staff commited on
Commit
5a8ffa4
·
1 Parent(s): a678b49

add basic logic

Browse files
Files changed (1) hide show
  1. app.py +13 -8
app.py CHANGED
@@ -42,6 +42,16 @@ PROBLEMS = {
42
  "❓ Other": "other",
43
  }
44
 
 
 
 
 
 
 
 
 
 
 
45
  # =====================================================================================================================
46
 
47
 
@@ -61,8 +71,8 @@ def is_valid_task_for_model(model_name, task_type):
61
 
62
 
63
  def get_suggestions(task_type, model_name, problem_type):
64
- if task_type == "" or problem_type == "":
65
- return "👈 Please select a task type and a problem type."
66
  return ""
67
  # =====================================================================================================================
68
 
@@ -78,11 +88,6 @@ with demo:
78
 
79
  This is a ever-evolving guide on how to improve your text generation results. It is community-led and
80
  curated by Hugging Face 🤗
81
-
82
- How to use it:
83
- 1. Answer the questions using the dropdown menus
84
- 2. Click on "Get Suggestions" button
85
- 3. Explore the suggestions and try them out! 💪
86
  """
87
  )
88
 
@@ -105,7 +110,7 @@ with demo:
105
  )
106
  button = gr.Button(value="Get Suggestions!")
107
  with gr.Column(scale=2):
108
- suggestions = gr.Markdown(value="👈 Please select a task type and a problem type.")
109
 
110
  button.click(get_suggestions, inputs=[task_type, model_name, problem_type], outputs=suggestions)
111
 
 
42
  "❓ Other": "other",
43
  }
44
 
45
+ INIT_MARKDOWN = """
46
+
47
+ 👈 Please select a task type...
48
+
49
+
50
+
51
+
52
+
53
+ 👈 ...and a problem type
54
+ """
55
  # =====================================================================================================================
56
 
57
 
 
71
 
72
 
73
  def get_suggestions(task_type, model_name, problem_type):
74
+ if task_type in ("" or None) or problem_type in ("" or None):
75
+ return INIT_MARKDOWN
76
  return ""
77
  # =====================================================================================================================
78
 
 
88
 
89
  This is a ever-evolving guide on how to improve your text generation results. It is community-led and
90
  curated by Hugging Face 🤗
 
 
 
 
 
91
  """
92
  )
93
 
 
110
  )
111
  button = gr.Button(value="Get Suggestions!")
112
  with gr.Column(scale=2):
113
+ suggestions = gr.Markdown(value=INIT_MARKDOWN)
114
 
115
  button.click(get_suggestions, inputs=[task_type, model_name, problem_type], outputs=suggestions)
116