yehezkielgunawan commited on
Commit
1b05490
1 Parent(s): 8de32f8

docs(app.py): :memo: just add documentation

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -12,13 +12,28 @@ tokenizer = AutoTokenizer.from_pretrained("indolem/indobert-base-uncased")
12
  model = AutoModel.from_pretrained("indolem/indobert-base-uncased")
13
 
14
  # Mapping dictionaries for labels
15
- priority_score_mapping = {1: "low", 2: "medium", 3: "high"}
16
- problem_domain_mapping = {0: "operational", 1: "tech"}
17
 
18
  # Load the trained Random Forest models
19
  best_classifier1 = joblib.load('best_classifier1_optimized.pkl')
20
  best_classifier2 = joblib.load('best_classifier2_optimized.pkl')
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  # Function to perform predictions
23
  def predict(text):
24
  # Convert the sentences into input features
@@ -59,4 +74,4 @@ def predict(text):
59
 
60
 
61
  # Create a Gradio interface
62
- gr.Interface(fn=predict, inputs="text", outputs="text", title="Simple Risk Classifier Demo").launch(debug=True)
 
12
  model = AutoModel.from_pretrained("indolem/indobert-base-uncased")
13
 
14
  # Mapping dictionaries for labels
15
+ priority_score_mapping = {1: "LOW", 2: "MEDIUM", 3: "HIGH"}
16
+ problem_domain_mapping = {0: "OPERATIONAL", 1: "TECHNICAL"}
17
 
18
  # Load the trained Random Forest models
19
  best_classifier1 = joblib.load('best_classifier1_optimized.pkl')
20
  best_classifier2 = joblib.load('best_classifier2_optimized.pkl')
21
 
22
+ markdown_text = '''
23
+ ## Label Description
24
+
25
+ ### Priority Score
26
+ * **Low** label, means that the temporary/corrective solution can solve the problem. A permanent solution will be provided later because the impact on the business can still be handled.
27
+ * **Medium** label, means that there's a need to determine the time constraint to solve the problem. If it remains too long, it will impact the business side.
28
+ * **High** label, means that the problem is urgent and must be solved immediately.
29
+
30
+ ### Problem Domain
31
+ * **Operational** label, means that the scope of the problem is on the business or daily operational.
32
+ * **Technical** label, means that the scope of the problem is on the technical (technology) side like the mobile/web application.
33
+ '''
34
+
35
+ description="Write the feedback about the capsule hotel that you've ever visited or stayed there."
36
+
37
  # Function to perform predictions
38
  def predict(text):
39
  # Convert the sentences into input features
 
74
 
75
 
76
  # Create a Gradio interface
77
+ gr.Interface(fn=predict, inputs="text", outputs="text", title="Simple Risk Classifier Demo (Case Study: Capsule Hotel)", description=description, article=markdown_text).launch(debug=True)