environments and quick fixes

This commit is contained in:
szymonj98 2023-05-31 16:54:44 +02:00
parent e3205cba15
commit 9bada7006c
5 changed files with 16 additions and 6 deletions

View File

@ -2,6 +2,7 @@ import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-errors-correction-page',
@ -48,7 +49,7 @@ export class ErrorsCorrectionPageComponent implements OnInit {
} else {
sentence = this.errorsForm.value.text
}
this.http.put('http://127.0.0.1:5000/get_errors', { sentence: sentence }).subscribe({
this.http.put(environment.errors, { sentence: sentence }).subscribe({
next: (resp: any) => {
this.correctedText = resp.predictions[0].generated_text
this.correctedTextLoading = true;

View File

@ -4,6 +4,7 @@ import { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'
import { Router } from '@angular/router';
import { concatMap, tap } from 'rxjs';
import { ChartConfiguration, ChartOptions, ChartType } from 'chart.js';
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-facebook-analysis',
@ -54,9 +55,9 @@ export class FacebookAnalysisComponent implements OnInit {
this.analysisStart = true
this.analysisLoading = false
let link = this.link.value
this.http.post('http://127.0.0.1:5000/scrapp_comments', { link: link }).pipe(concatMap((resp: any) => {
this.http.post(environment.facebook, { link: link }).pipe(concatMap((resp: any) => {
this.post = resp.post
return this.http.post('http://127.0.0.1:5000/get_sentiment_data', { sentences: resp.comments }).pipe(tap((resp: any) => {
return this.http.post(environment.sentiment, { sentences: resp.sentences }).pipe(tap((resp: any) => {
console.log(resp)
this.results = resp.predictions
this.barChartData.datasets = [

View File

@ -3,6 +3,7 @@ import { Component, OnInit } from '@angular/core';
import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { Router } from '@angular/router';
import { ChartConfiguration, ChartOptions, ChartType } from 'chart.js';
import { environment } from 'src/environments/environment';
@Component({
selector: 'app-sentiment-analysis',
@ -77,7 +78,7 @@ export class SentimentAnalysisComponent implements OnInit {
let value = this.sentimentForm.value
sentences = value.sentences.map((value: any) => value.text)
}
this.http.post('http://127.0.0.1:5000/get_sentiment_data', { sentences: sentences }).subscribe({
this.http.post(environment.sentiment, { sentences: sentences }).subscribe({
next: (resp: any) => {
this.results = resp.predictions
console.log(resp)

View File

@ -1,3 +1,7 @@
export const environment = {
production: true
production: true,
sentiment: 'magisterka-backend.azurewebsites.net/get_sentiment_data',
errors: 'magisterka-backend.azurewebsites.net/get_errors',
facebook: 'magisterka-backend.azurewebsites.net/scrapp_comments'
};

View File

@ -3,7 +3,10 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
production: false
production: false,
sentiment: 'http://127.0.0.1:5000/get_sentiment_data',
errors: 'http://127.0.0.1:5000/get_errors',
facebook: 'http://127.0.0.1:5000/scrapp_comments'
};
/*