github-actions[bot] commited on
Commit
7bea42e
·
1 Parent(s): 8d398ee

Sync turing folder from GitHub

Browse files
Files changed (1) hide show
  1. turing/api/demo.py +8 -7
turing/api/demo.py CHANGED
@@ -20,8 +20,8 @@ FEEDBACK_FILE = "reports/feedback/feedback_data.csv"
20
 
21
  LABELS_MAP = {
22
  "java": ["summary", "Ownership", "Expand", "usage", "Pointer", "deprecation", "rational"],
23
- "python": ["Usage", "Parameters", "DevelopmentNotes", "Expand", "Summary"],
24
- "pharo": ["Keyimplementationpoints", "Example", "Responsibilities", "Intent", "Keymessages", "Collaborators"],
25
  }
26
 
27
  # --- CSS ---
@@ -207,11 +207,12 @@ def create_demo(inference_engine: ModelInference):
207
  )
208
 
209
  if labels and len(labels) > 0:
210
- first_prediction = labels[0][0]
211
- if isinstance(first_prediction, (list, tuple)):
212
- return first_prediction[0]
213
- else:
214
- return str(first_prediction)
 
215
 
216
  return "Unknown: Low confidence."
217
 
 
20
 
21
  LABELS_MAP = {
22
  "java": ["summary", "Ownership", "Expand", "usage", "Pointer", "deprecation", "rational"],
23
+ "python": ["Usage", "Parameters", "Development Notes", "Expand", "Summary"],
24
+ "pharo": ["Key implementation points", "Example", "Responsibilities", "Intent", "Key messages", "Collaborators"],
25
  }
26
 
27
  # --- CSS ---
 
207
  )
208
 
209
  if labels and len(labels) > 0:
210
+ predicted_labels = labels[0]
211
+
212
+ if isinstance(predicted_labels, list):
213
+ return ", ".join(str(lab) for lab in predicted_labels)
214
+
215
+ return str(predicted_labels)
216
 
217
  return "Unknown: Low confidence."
218