-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
41 lines (35 loc) · 1.41 KB
/
Program.cs
File metadata and controls
41 lines (35 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using hateSpeach.Models;
using hateSpeach.Services;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Microsoft.ML;
using Microsoft.ML.Runtime.LightGBM;
namespace hateSpeach
{
public class Program
{
public static async Task Main(string[] args)
{
// workaround to ensure LightGbm assembly is loaded
//new LightGbmArguments();
//Uncomment these two lines to train new models, after finish copy .Zip files from bin/Debug folder to the root folder
//await MLTraining.LanguageTrainAsync();
//await MLTraining.SentimentTrainAsync();
MLTraining.LanguageModel = await PredictionModel.ReadAsync<LanguageModel, LanguagePrediction>(DataPath.LanguageModelPath);
MLTraining.SentimentModel = await PredictionModel.ReadAsync<SentimentModel, SentimentPrediction>(DataPath.SentimentModelPath);
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args).UseKestrel(options => {
options.Listen(IPAddress.Any, 3000); //HTTP port
}).UseStartup<Startup>();
}
}