Restructured project and implemented virtual python environments to isolate application. Added launch scripts too.
This commit is contained in:
parent
a2c0080662
commit
17b99ca836
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
@ -16,6 +16,7 @@ try:
|
||||
import winsound
|
||||
HAS_WINSOUND = True
|
||||
except ImportError:
|
||||
winsound = None
|
||||
HAS_WINSOUND = False
|
||||
|
||||
class OverlayCanvas(QtWidgets.QWidget):
|
80
Experiments/flowpipe.py
Normal file
80
Experiments/flowpipe.py
Normal file
@ -0,0 +1,80 @@
|
||||
from flask import Flask, jsonify
|
||||
from flowpipe.node import Node
|
||||
from flowpipe.graph import Graph
|
||||
from flowpipe.plug import InputPlug, OutputPlug
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
# ===========================
|
||||
# Define Custom Nodes
|
||||
# ===========================
|
||||
|
||||
class MultiplyNode(Node):
|
||||
"""Multiplies an input value by a factor"""
|
||||
factor = InputPlug()
|
||||
value = InputPlug()
|
||||
result = OutputPlug()
|
||||
|
||||
def compute(self):
|
||||
self.result.value = self.value.value * self.factor.value
|
||||
|
||||
|
||||
class AddNode(Node):
|
||||
"""Adds two input values"""
|
||||
input1 = InputPlug()
|
||||
input2 = InputPlug()
|
||||
sum = OutputPlug()
|
||||
|
||||
def compute(self):
|
||||
self.sum.value = self.input1.value + self.input2.value
|
||||
|
||||
|
||||
class OutputNode(Node):
|
||||
"""Outputs the final result"""
|
||||
input_value = InputPlug()
|
||||
output_value = OutputPlug()
|
||||
|
||||
def compute(self):
|
||||
self.output_value.value = self.input_value.value
|
||||
|
||||
|
||||
# ===========================
|
||||
# Define Graph Workflow
|
||||
# ===========================
|
||||
|
||||
def create_workflow():
|
||||
"""Creates a sample workflow using nodes"""
|
||||
graph = Graph(name="Sample Workflow")
|
||||
|
||||
# Create nodes
|
||||
multiply = MultiplyNode(name="Multiplier", graph=graph)
|
||||
add = AddNode(name="Adder", graph=graph)
|
||||
output = OutputNode(name="Output", graph=graph)
|
||||
|
||||
# Connect nodes
|
||||
multiply.result.connect(add.input1) # Multiply output -> Add input1
|
||||
add.sum.connect(output.input_value) # Add output -> Output node
|
||||
|
||||
# Set static input values
|
||||
multiply.factor.value = 2
|
||||
multiply.value.value = 5 # 5 * 2 = 10
|
||||
add.input2.value = 3 # 10 + 3 = 13
|
||||
|
||||
return graph
|
||||
|
||||
|
||||
@app.route('/run-workflow', methods=['GET'])
|
||||
def run_workflow():
|
||||
"""Runs the defined node-based workflow"""
|
||||
graph = create_workflow()
|
||||
graph.evaluate() # Execute the graph
|
||||
|
||||
# Extract the final result from the output node
|
||||
output_node = graph.nodes["Output"]
|
||||
result = output_node.output_value.value
|
||||
|
||||
return jsonify({"workflow_result": result})
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
@ -1,5 +0,0 @@
|
||||
We need to run the following commands to install the prerequisites for the project.
|
||||
|
||||
|
||||
This command is used to install pytorch and torchvision for the purposes of GPU-accelerated vision tasks.
|
||||
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
112
Start_Linux.sh
Normal file
112
Start_Linux.sh
Normal file
@ -0,0 +1,112 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Start_Linux.sh
|
||||
# -----------------------------------------------
|
||||
# Bootstrap Borealis Virtual Python Environment
|
||||
# Usage: chmod +x Start_Linux.sh && ./Start_Linux.sh
|
||||
#
|
||||
|
||||
: '
|
||||
---------------------------------------------------
|
||||
SECTION 1: Script Initialization & Path Definitions
|
||||
---------------------------------------------------
|
||||
This section defines all necessary paths and variables to be used
|
||||
throughout the script, ensuring clarity and maintainability.
|
||||
'
|
||||
|
||||
# Define paths
|
||||
venvPath="Borealis-Workflow-Automation-Tool"
|
||||
dataSource="Data"
|
||||
dataDestination="$venvPath/Borealis"
|
||||
|
||||
|
||||
: '
|
||||
---------------------------------------------------
|
||||
SECTION 2: Virtual Environment Creation
|
||||
---------------------------------------------------
|
||||
In this section, we check if the virtual environment already exists
|
||||
by verifying the presence of the "activate" script. If it doesn’t
|
||||
exist, we create it.
|
||||
'
|
||||
|
||||
if [ ! -f "$venvPath/bin/activate" ]; then
|
||||
echo "Creating virtual environment '$venvPath'..."
|
||||
python3 -m venv "$venvPath"
|
||||
else
|
||||
echo "Virtual environment '$venvPath' already exists."
|
||||
fi
|
||||
|
||||
|
||||
: '
|
||||
---------------------------------------------------
|
||||
SECTION 3: Copy Data Folder
|
||||
---------------------------------------------------
|
||||
If the "Data" folder is present, we remove any previously copied data
|
||||
in the virtual environment’s "Borealis" directory, create a new
|
||||
"Borealis" folder, and then copy the "Data" folder into it.
|
||||
'
|
||||
|
||||
if [ -d "$dataSource" ]; then
|
||||
echo "Copying Data folder into virtual environment..."
|
||||
|
||||
# Remove old data if it exists
|
||||
if [ -d "$dataDestination" ]; then
|
||||
rm -rf "$dataDestination"
|
||||
fi
|
||||
|
||||
# Create the Borealis directory inside the virtual environment
|
||||
mkdir -p "$dataDestination"
|
||||
|
||||
# Copy Data into the virtual environment under Borealis
|
||||
cp -r "$dataSource/"* "$dataDestination/"
|
||||
else
|
||||
echo "Warning: Data folder not found, skipping copy."
|
||||
fi
|
||||
|
||||
|
||||
: '
|
||||
---------------------------------------------------
|
||||
SECTION 4: Activate Environment & Install Dependencies
|
||||
---------------------------------------------------
|
||||
This section activates the newly created (or existing) virtual
|
||||
environment and installs required dependencies based on the
|
||||
"requirements.txt" file if it exists.
|
||||
'
|
||||
|
||||
echo "Activating virtual environment..."
|
||||
source "$venvPath/bin/activate"
|
||||
|
||||
if [ -f "requirements.txt" ]; then
|
||||
echo "Installing dependencies..."
|
||||
pip install -r requirements.txt
|
||||
else
|
||||
echo "No requirements.txt found, skipping installation."
|
||||
fi
|
||||
|
||||
|
||||
: '
|
||||
---------------------------------------------------
|
||||
SECTION 5: Run Main Script
|
||||
---------------------------------------------------
|
||||
Run the main Python script from within the copied Data folder
|
||||
inside the virtual environment.
|
||||
'
|
||||
|
||||
if [ -f "$dataDestination/borealis.py" ]; then
|
||||
echo "Starting Borealis Workflow Automation Tool..."
|
||||
python "$dataDestination/borealis.py"
|
||||
else
|
||||
echo "borealis.py not found in $dataDestination. Skipping execution."
|
||||
fi
|
||||
|
||||
|
||||
: '
|
||||
---------------------------------------------------
|
||||
SECTION 6: Deactivate Environment
|
||||
---------------------------------------------------
|
||||
After the main script completes execution, the virtual environment
|
||||
is deactivated.
|
||||
'
|
||||
|
||||
echo "Deactivating virtual environment..."
|
||||
deactivate
|
50
Start_Windows.ps1
Normal file
50
Start_Windows.ps1
Normal file
@ -0,0 +1,50 @@
|
||||
# Bootstrap Borealis Virtual Python Environment
|
||||
# Run Script: "Set-ExecutionPolicy Unrestricted -Scope Process .\Start_Windows.ps1"
|
||||
|
||||
# Define paths
|
||||
$venvPath = "Borealis-Workflow-Automation-Tool"
|
||||
$dataSource = "Data"
|
||||
$dataDestination = "$venvPath\Borealis"
|
||||
|
||||
# Check if virtual environment exists
|
||||
if (!(Test-Path "$venvPath\Scripts\Activate")) {
|
||||
Write-Output "Creating virtual environment '$venvPath'..."
|
||||
python -m venv $venvPath
|
||||
}
|
||||
|
||||
# Ensure the Data folder exists before copying
|
||||
if (Test-Path $dataSource) {
|
||||
Write-Output "Copying Data folder into virtual environment..."
|
||||
|
||||
# Remove old data if it exists
|
||||
if (Test-Path $dataDestination) {
|
||||
Remove-Item -Recurse -Force $dataDestination
|
||||
}
|
||||
|
||||
# Create the Borealis directory inside the virtual environment
|
||||
New-Item -Path $dataDestination -ItemType Directory -Force | Out-Null
|
||||
|
||||
# Copy Data into the virtual environment under Borealis
|
||||
Copy-Item -Path "$dataSource\*" -Destination $dataDestination -Recurse
|
||||
} else {
|
||||
Write-Output "Warning: Data folder not found, skipping copy."
|
||||
}
|
||||
|
||||
# Activate virtual environment
|
||||
Write-Output "Activating virtual environment..."
|
||||
. "$venvPath\Scripts\Activate"
|
||||
|
||||
# Install dependencies
|
||||
if (Test-Path "requirements.txt") {
|
||||
Write-Output "Installing dependencies..."
|
||||
pip install -r requirements.txt
|
||||
} else {
|
||||
Write-Output "No requirements.txt found, skipping installation."
|
||||
}
|
||||
|
||||
# Run the main script from inside the copied Data folder
|
||||
Write-Output "Starting Borealis Workflow Automation Tool..."
|
||||
python "$dataDestination\borealis.py"
|
||||
|
||||
# Deactivate after execution
|
||||
deactivate
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
21
requirements.txt
Normal file
21
requirements.txt
Normal file
@ -0,0 +1,21 @@
|
||||
# PyTorch and related deep learning libraries (GPU Supported Functionality)
|
||||
torch --index-url https://download.pytorch.org/whl/cu121
|
||||
torchvision --index-url https://download.pytorch.org/whl/cu121
|
||||
torchaudio --index-url https://download.pytorch.org/whl/cu121
|
||||
|
||||
# Flask for API handling
|
||||
Flask
|
||||
requests
|
||||
|
||||
# GUI-related dependencies (Qt for GUI components)
|
||||
Qt.py
|
||||
qtpy
|
||||
OdenGraphQt
|
||||
PyQt5
|
||||
|
||||
# Computer Vision & OCR dependencies
|
||||
numpy # Numerical operations
|
||||
opencv-python # Computer vision processing
|
||||
pytesseract # OCR engine
|
||||
easyocr # Deep-learning-based OCR
|
||||
Pillow # Image processing
|
Loading…
x
Reference in New Issue
Block a user