Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dotenv #47

Merged
merged 5 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import pandas as pd
import nltk
import os
from dotenv import load_dotenv
import json
import openai
import asyncio
Expand All @@ -25,7 +24,6 @@

nltk.download('wordnet')

load_dotenv()
app = Flask(__name__)
CORS(app) # CORS(app, resources={r"/*": {"origins": "http://localhost:3000"}})
server_thread = None
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Cameron",
"email": "[email protected]"
},
"version": "0.3.0",
"version": "0.2.5",
"main": "./public/electron.js",
"homepage": "./",
"private": true,
Expand Down
36 changes: 36 additions & 0 deletions src/components/breadcumbs/breadcumbs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import React from 'react';
import { Link } from 'react-router-dom';

interface Crumb {
label: string;
path?: string;
}

interface BreadcrumbProps {
crumbs: Crumb[];
}

const Breadcrumb: React.FC<BreadcrumbProps> = ({ crumbs }) => {
const baseCrumb = { label: 'LinguifAI', path: '/' };
const allCrumbs = [baseCrumb, ...crumbs];

return (
<div className="p-4">
<nav aria-label="breadcrumb">
<ol className="flex space-x-2 text-lg">
{allCrumbs.map((crumb, index) => (
<li key={index} className={`flex items-center ${!crumb.path ? 'text-gray-500' : ''}`}>
{index !== 0 && <span className="mx-2 text-gray-400">/</span>}
{crumb.path ? (
<Link to={crumb.path} className="text-blue-800 hover:underline font-semibold">{crumb.label}</Link>
) : (<span className="font-semibold">{crumb.label}</span>
)}
</li>
))}
</ol>
</nav>
</div>
);
};

export default Breadcrumb;
1 change: 1 addition & 0 deletions src/components/selectFileCard/selectFileCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export default function SelectFileCard({
onChange={handleFileChange}
/>
</h2>
<p className="text-sm text-gray-600">Por favor, selecione um arquivo no formato .csv</p>
</div>
) : (
<div
Expand Down
8 changes: 7 additions & 1 deletion src/pages/about.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import Breadcrumb from "../components/breadcumbs/breadcumbs";
import Layout from "./layout/layout";
import AboutView from "./views/aboutView";

export default function About() {

return <Layout><AboutView /></Layout>;
return (
<Layout>
<Breadcrumb crumbs={[{ label: "Sobre" }]} />
<AboutView />
</Layout>
)

}
6 changes: 5 additions & 1 deletion src/pages/home.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import Breadcrumb from "../components/breadcumbs/breadcumbs";
import Layout from "./layout/layout";
import HomeView from "./views/homeView";


export default function Home() {
return <Layout><HomeView /></Layout>;
return <Layout>
<Breadcrumb crumbs={[{ label: "Classificar" }]} />
<HomeView />
</Layout>;
}
6 changes: 5 additions & 1 deletion src/pages/train.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ import { Menu } from "../components/menu/menu";
import { ReactApexChartsDefaultOptions } from "../Shared/apexChartsOptions";
import Layout from "./layout/layout";
import TrainView from "./views/trainView";
import Breadcrumb from "../components/breadcumbs/breadcumbs";

export default function Train() {

return (
<Layout><TrainView /></Layout>
<Layout>
<Breadcrumb crumbs={[{ label: "Treinar" }]} />
<TrainView />
</Layout>
);
}
39 changes: 27 additions & 12 deletions src/pages/views/trainView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export default function TrainView() {
const newProgress: number =
training_in_progress || training_progress === 100
? training_progress
: 0;
: 0;
updateLoadingProgress(newProgress);

setTrainLosses(train_losses);
Expand Down Expand Up @@ -205,6 +205,12 @@ export default function TrainView() {
return () => clearInterval(interval);
}, []);

const [trainingType, setTrainingType] = useState<string>("nb");

const handleTrainingTypeChange = (event: React.ChangeEvent<HTMLSelectElement>) => {
setTrainingType(event.target.value);
}

return (
<div className="p-8 text-center">
<SelectFileCard
Expand Down Expand Up @@ -314,6 +320,23 @@ export default function TrainView() {
</div>



<div className="w-1/2 mx-auto mt-10 mb-4">
<label htmlFor="trainingType" className="block mb-2">
Tipo de Treinamento
</label>
<select
id="trainingType"
className="w-full border-2 border-gray-500 rounded-xl py-2 px-4 hover:bg-gray-100 focus:outline-none h-14"
onChange={handleTrainingTypeChange}
value={trainingType}
>
<option value="nb">NB (Naive Bayes)</option>
<option value="rnn">RNN (Recurrent Neural Network)</option>
</select>
</div>


<div className="w-1/2 relative mx-auto mt-10">
<div className="relative w-full">
{isLoading && (
Expand All @@ -330,19 +353,11 @@ export default function TrainView() {
)}

{!isLoading && <button
className={`w-2/4 bg-blue-400 text-white py-2 px-4 hover:bg-blue-500 focus:outline-none border-2 border-blue-500 rounded-xl h-14`}
onClick={handleNbSubmit}
disabled={isLoading}
>
{isLoading ? "Carregando..." : "Treinar NB"}
</button>}

{!isLoading && <button
className={`w-2/4 bg-blue-400 text-white py-2 px-4 hover:bg-blue-500 focus:outline-none border-2 border-blue-500 rounded-xl h-14`}
onClick={handleRnnSubmit}
className={`w-full bg-blue-400 text-white py-2 px-4 hover:bg-blue-500 focus:outline-none border-2 border-blue-500 rounded-xl h-14`}
onClick={trainingType === "nb" ? handleNbSubmit : handleRnnSubmit}
disabled={isLoading}
>
{isLoading ? "Carregando..." : "Treinar RNN"}
{isLoading ? "Carregando..." : "Treinar"}
</button>}

{hasTrained && train_losses.length > 0 && (
Expand Down
Loading