-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
312 additions
and
171 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,62 @@ | ||
# Check and install Python if not installed | ||
# Function to check and install Python | ||
function Install-Python { | ||
if (-not (Get-Command python3 -ErrorAction SilentlyContinue)) { | ||
Write-Output "Python3 could not be found. Installing Python3..." | ||
Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.9.5/python-3.9.5-amd64.exe" -OutFile "python-installer.exe" | ||
Start-Process -FilePath "python-installer.exe" -ArgumentList "/quiet InstallAllUsers=1 PrependPath=1" -Wait | ||
Remove-Item -Path "python-installer.exe" -Force | ||
|
||
# Verify installation | ||
if (-not (Get-Command python3 -ErrorAction SilentlyContinue)) { | ||
Write-Output "Python3 installation failed. Please install Python3 manually." | ||
exit 1 | ||
} | ||
Invoke-WebRequest -Uri https://www.python.org/ftp/python/3.9.5/python-3.9.5-amd64.exe -OutFile python-installer.exe | ||
Start-Process -FilePath python-installer.exe -ArgumentList '/quiet InstallAllUsers=1 PrependPath=1' -Wait | ||
Remove-Item python-installer.exe | ||
} else { | ||
Write-Output "Python3 is already installed." | ||
} | ||
} | ||
|
||
# Install Python dependencies | ||
# Function to install Python dependencies | ||
function Install-PythonDependencies { | ||
Write-Output "Installing Python dependencies..." | ||
python3 -m pip install --upgrade pip | ||
python3 -m pip install -r requirements.txt | ||
pip3 install -r requirements.txt | ||
} | ||
|
||
# Install npm dependencies | ||
function Install-NpmDependencies { | ||
Write-Output "Installing npm dependencies..." | ||
npm install | ||
# Function to check and install Docker | ||
function Install-Docker { | ||
if (-not (Get-Command docker -ErrorAction SilentlyContinue)) { | ||
Write-Output "Docker could not be found. Installing Docker..." | ||
Invoke-WebRequest -Uri https://desktop.docker.com/win/stable/Docker%20Desktop%20Installer.exe -OutFile docker-installer.exe | ||
Start-Process -FilePath docker-installer.exe -ArgumentList '/quiet' -Wait | ||
Remove-Item docker-installer.exe | ||
} else { | ||
Write-Output "Docker is already installed." | ||
} | ||
} | ||
|
||
# Start the servers | ||
function Start-Servers { | ||
Write-Output "Starting the server with npm start..." | ||
Start-Process -NoNewWindow -FilePath "npm" -ArgumentList "start" | ||
|
||
Write-Output "Starting the FastAPI server with uvicorn..." | ||
Start-Process -NoNewWindow -FilePath "python" -ArgumentList "-m uvicorn server:app --host 0.0.0.0 --port 8000 --reload" | ||
# Function to run Docker container | ||
function Run-DockerContainer { | ||
Write-Output "Running Docker container..." | ||
docker build -t tss_2024 . | ||
docker run -it -p 14141:14141 --name tss_2024 tss_2024 | ||
} | ||
|
||
# Execute functions | ||
# Check and install Python | ||
Install-Python | ||
|
||
# Install Python dependencies | ||
Install-PythonDependencies | ||
Install-NpmDependencies | ||
Start-Servers | ||
|
||
# Check and install Docker | ||
Install-Docker | ||
|
||
# Run Docker container | ||
Start-Job -ScriptBlock { | ||
Run-DockerContainer | ||
} | ||
|
||
# Installing npm dependencies | ||
Write-Output "Installing npm dependencies..." | ||
npm install | ||
|
||
# Starting the server | ||
Write-Output "Starting the server with npm start..." | ||
Start-Process -NoNewWindow npm start | ||
|
||
# Starting the FastAPI server | ||
Write-Output "Starting the FastAPI server with uvicorn..." | ||
Start-Process -NoNewWindow uvicorn server:app --host 0.0.0.0 --port 8000 --reload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import './constant.css'; | ||
|
||
const Modal = ({ isVisible, hideModal, content }) => { | ||
if (!isVisible) return null; | ||
|
||
return ( | ||
<div className="modal" style={{ display: 'flex' }}> | ||
<div className="modal-content"> | ||
<span className="close" onClick={hideModal}>×</span> | ||
{content} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Modal; |
Oops, something went wrong.