Exemple #1
0
def predict_artist(lyrics):
    # TODO transform (stem) the lyrics
    lyrics = transformLyrics(lyrics)
    # TODO predict the artist for the lyrics. Note that predict will
    # interpret the argument as a list.
    prediction = pipeline.predict([lyrics])
    # TODO return a string naming the predicted artist.
    return 'Predicted Artist: %s' % prediction
def predict_artist(lyrics):
    lyrics = transformLyrics(lyrics)
    print 'predicting artist for %s' % lyrics
    prediction = pipeline.predict([lyrics])
    # TODO instead of returning a string, render the prediction.html template.
    # TODO
    d = {'lyrics': lyrics, 'artist': prediction[0]}
    return render_template('prediction.html', d=d)
Exemple #3
0
def predict_artist():
    # TODO get the lyrics from the body of the POST request

    lyrics = transformLyrics(lyrics)
    print 'predicting artist for %s' % lyrics
    prediction = pipeline.predict([lyrics])
    d = {'lyrics': lyrics, 'artist': prediction[0]}
    return render_template('prediction.html', d=d)
def predict_artist(lyrics):
    # TODO transform (stem) the lyrics
    lyrics = transformLyrics(lyrics)
    # TODO predict the artist for the lyrics. Note that predict will
    # interpret the argument as a list.
    prediction = pipeline.predict([lyrics])
    # TODO return a string naming the predicted artist.
    return 'Predicted Artist: %s' % prediction
def predict_artist(lyrics):
    lyrics = transformLyrics(lyrics)
    print "predicting artist for %s" % lyrics
    prediction = pipeline.predict([lyrics])
    # TODO instead of returning a string, render the prediction.html template.
    # TODO
    d = {"lyrics": lyrics, "artist": prediction[0]}
    return render_template("prediction.html", d=d)
 def predictArtist(self, lyrics):
     """Returns an artist name given sample song lyrics.
     Applies the Million Song Dataset stemming routine to
     the lyrics (pre-processing), vectorizes the lyrics,
     and runs them through the MultinomialNB classifier.
     Returns the artist name associated with the predicted
     label.
     """
     transformed_lyrics = transformLyrics(lyrics)
     return ""
 def predictArtist(self,lyrics):
     """Returns an artist name given sample song lyrics.
     Applies the Million Song Dataset stemming routine to
     the lyrics (pre-processing), vectorizes the lyrics,
     and runs them through the MultinomialNB classifier.
     Returns the artist name associated with the predicted
     label.
     """
     transformed_lyrics = transformLyrics(lyrics)
     return ""
def predict_artist():
    # TODO get the lyrics from the body of the POST request
    lyrics = request.form['lyrics']
    lyrics = transformLyrics(lyrics)
    print 'predicting artist for %s' % lyrics
    prediction = pipeline.predict([lyrics])
    d = {
        'lyrics': lyrics,
        'artist': prediction[0]
    }
    return render_template('prediction.html', d=d)
Exemple #9
0
def predict_artist(lyrics):
    lyrics = transformLyrics(lyrics)
    print 'predicting artist for %s' % lyrics
    prediction = pipeline.predict([lyrics])
    # TODO instead of returning a string, render the prediction.html template.
    # TODO create a dictionary containing the keys 'lyrics' and 'artists' that
    # TODO will be used to complete the template.
    d = {
        'lyrics': lyrics,
        'artist': prediction[0]
    }
    return render_template('prediction.html', d=d)
 def predictArtist(self,lyrics):
     """Returns an artist name given sample song lyrics.
     Applies the Million Song Dataset stemming routine to
     the lyrics (pre-processing), vectorizes the lyrics,
     and runs them through the MultinomialNB classifier.
     Returns the artist name associated with the predicted
     label.
     """
     transformed_lyrics = transformLyrics(lyrics)
     df = pd.DataFrame({'Lyrics':[transformed_lyrics]})
     X = self.vectorizer.transform(df['Lyrics'])
     y = self.clf.predict(X)
     for artist, label in self.artistLabels.items():
         if label == y:
             return artist
     return "Artist Not Found (predicted label %d)"%(y)
 def predictArtist(self, lyrics):
     """Returns an artist name given sample song lyrics.
     Applies the Million Song Dataset stemming routine to
     the lyrics (pre-processing), vectorizes the lyrics,
     and runs them through the MultinomialNB classifier.
     Returns the artist name associated with the predicted
     label.
     """
     transformed_lyrics = transformLyrics(lyrics)
     df = pd.DataFrame({'Lyrics': [transformed_lyrics]})
     X = self.vectorizer.transform(df['Lyrics'])
     y = self.clf.predict(X)
     for artist, label in self.artistLabels.items():
         if label == y:
             return artist
     return "Artist not found (prdeict label %d" % y
Exemple #12
0
def predict_artist(lyrics):
    lyrics = transformLyrics(lyrics)
    print 'predicting artist for %s' % lyrics
    prediction = pipeline.predict([lyrics])
    return 'Predicted Artist: %s' % prediction
def predict_artist(lyrics):
    lyrics = transformLyrics(lyrics)
    print 'predicting artist for %s' % lyrics
    prediction = pipeline.predict([lyrics])
    return 'Predicted Artist: %s' % prediction