joaogante HF staff commited on
Commit
15a9b76
1 Parent(s): 29462dd

add basic logic

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -58,6 +58,12 @@ def is_valid_task_for_model(model_name, task_type):
58
 
59
  possible_tags = HUB_TAGS[TASK_TYPES[task_type]]
60
  return any(tag in model_tags for tag in possible_tags)
 
 
 
 
 
 
61
  # =====================================================================================================================
62
 
63
 
@@ -97,16 +103,13 @@ with demo:
97
  choices=list(PROBLEMS.keys()),
98
  interactive=True,
99
  )
100
- get_suggestions = gr.Button(value="Get Suggestions!")
101
  with gr.Column(scale=2):
102
- box = gr.Textbox()
 
 
 
103
 
104
- gr.Markdown(
105
- """
106
- Is your problem not on the list? Need more suggestions? Have you spotted an error? Please open a
107
- [new discussion](https://huggingface.co/spaces/joaogante/generate_quality_improvement/discussions) 🙏
108
- """
109
- )
110
  # =====================================================================================================================
111
 
112
  if __name__ == "__main__":
 
58
 
59
  possible_tags = HUB_TAGS[TASK_TYPES[task_type]]
60
  return any(tag in model_tags for tag in possible_tags)
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
 
69
 
 
103
  choices=list(PROBLEMS.keys()),
104
  interactive=True,
105
  )
106
+ button = gr.Button(value="Get Suggestions!")
107
  with gr.Column(scale=2):
108
+ suggestions = gr.Markdown(value="")
109
+
110
+ button.click(get_suggestions, inputs=[task_type, model_name, problem_type], outputs=suggestions)
111
+
112
 
 
 
 
 
 
 
113
  # =====================================================================================================================
114
 
115
  if __name__ == "__main__":