Antoine Lelong commited on
Commit
42dee0e
·
unverified ·
1 Parent(s): b0760ef

fix: revert back float code

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -43,8 +43,7 @@ class FastTextModelTester:
43
  results = []
44
  for i in range(len(labels)):
45
  label = labels[i].replace('__label__', '')
46
- # Convert to native Python float to avoid numpy array issues
47
- prob = float(probabilities[i])
48
  results.append(f"{label}: {prob:.4f}")
49
 
50
  return "\n".join(results)
@@ -52,9 +51,7 @@ class FastTextModelTester:
52
  # For word embedding models
53
  else:
54
  vector = self.model.get_word_vector(text)
55
- # Convert to list to avoid numpy array issues
56
- vector_list = [float(x) for x in vector[:5]]
57
- return f"Word vector (first 5 dimensions): {vector_list}"
58
 
59
  except Exception as e:
60
  return f"Error during prediction: {str(e)}"
 
43
  results = []
44
  for i in range(len(labels)):
45
  label = labels[i].replace('__label__', '')
46
+ prob = probabilities[i]
 
47
  results.append(f"{label}: {prob:.4f}")
48
 
49
  return "\n".join(results)
 
51
  # For word embedding models
52
  else:
53
  vector = self.model.get_word_vector(text)
54
+ return f"Word vector (first 5 dimensions): {vector[:5]}"
 
 
55
 
56
  except Exception as e:
57
  return f"Error during prediction: {str(e)}"