Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

306
Views
Cómo realizar la clasificación de texto usando tensorflowjs

Tengo un modelo de clasificación de texto binario cargado en tensorflowjs usando loadGraphModel() y quiero usar el modelo para predecir si una oración es positiva o negativa. Por ejemplo, una nueva oración "Estoy triste" se pasa al modelo, y la predecirá y la generará como negativa. ¿Puedo saber cómo hacer esto, porque model.predict() parece funcionar solo para imágenes? Este es mi fragmento de código.

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> </head> <body> <p id="cat">I am sad</p> <script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@2.0.0/dist/tf.min.js"></script> <script> const MODEL_URL = './model.json'; const model = tf.loadGraphModel(MODEL_URL); model.then(function (res){ const text = document.getElementById('cat').textContent; const prediction = res.predict(text); //Prediction should be 0(negative) console.log(prediction) }); </script> </body> </html>

Este es el error en mi consola.

 Uncaught (in promise) Error: The dict provided in model.execute(dict) has keys: [0,1,2,3,4,5,6,7] that are not part of graph at techeckInputs (graph_executor.js:476:13) at teexecute (graph_executor.js:140:10) at teexecute (graph_model.js:288:34) at tepredict (graph_model.js:242:17) at test.html:18:27

Gracias.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!