Skip to content

Commit e72dc90

Browse files
committed
add demo link
1 parent 4e5901d commit e72dc90

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Autotagging Overflow
22
The objective of this pipeline is to enable autotagging of stack overflow questions and answers. The model will be trained with TF-IDF with Spark MLlib in batch processing. Then the model would be used to autotag the new coming questions from Kafka (latency?). Finally the data will be persisted in Cassandra to support the front end.
33

4+
<a href = https://youtu.be/WYg8NzZs4Us > DEMO </a>
5+
46
# Sample datasets
57

68
<p align="center">

autotagOverflow/index.js

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -83,27 +83,27 @@ app.get('/home/:post_id', function(req, res){
8383
var post_id = req.params.post_id;
8484
var tag;
8585
console.log('Retriving data for post_id %s', post_id);
86-
// cassandraClient.execute("SELECT tag FROM "+table +" WHERE id = '" + post_id + "'", function(err, result){
87-
// if (!err){
88-
// if ( result.rows.length > 0 ) {
89-
// var user = result.rows[0];
90-
// var tag=user.tag;
91-
// res.send({tag: tag});
92-
// } else {
93-
// console.log("No results");
94-
// }
95-
// }
96-
// });
97-
redis_client.hmget(post_id, 'tags', function(err, result){
98-
if (!err){
99-
if ( result.length > 0 ) {
100-
var tag = result[0];
101-
res.send({tag: tag});
102-
} else {
103-
console.log("No results");
104-
}
105-
}
106-
});
86+
cassandraClient.execute("SELECT tag FROM "+table +" WHERE id = '" + post_id + "'", function(err, result){
87+
if (!err){
88+
if ( result.rows.length > 0 ) {
89+
var user = result.rows[0];
90+
var tag=user.tag;
91+
res.send({tag: tag});
92+
} else {
93+
console.log("No results");
94+
}
95+
}
96+
});
97+
// redis_client.hmget(post_id, 'tags', function(err, result){
98+
// if (!err){
99+
// if ( result.length > 0 ) {
100+
// var tag = result[0];
101+
// res.send({tag: tag});
102+
// } else {
103+
// console.log("No results");
104+
// }
105+
// }
106+
// });
107107
})
108108

109109
app.post('/home', function(req, res){

autotagOverflow/public/js/get_tag.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $(function(){
1010
success:function(data,status){
1111
if(status == 'success'){
1212
var after_time = new Date().getTime();
13-
alert((after_time - start_time) + 'ms')
13+
// alert('It takes '+(after_time - start_time) + 'ms to get the tag!')
1414
var tag = data.tag;
1515
$('#predicted_tag').text(tag);
1616
$('#predicted_tag').val(tag);

kafka_producer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def generate_data():
100100
while True:
101101
for line in posts:
102102
send_to_broker(kafka_producer, line,)
103-
time.sleep(5)
103+
time.sleep(2)
104104

105105
if __name__ == '__main__':
106106

0 commit comments

Comments
 (0)