nabhot/extreme-value-analysis
Extreme Value Analysis (EVA) Web Application
An interactive web application for conducting Extreme Value Analysis (EVA) on particle/inclusion sizes using the Gumbel distribution (4-quadrant method).
๐ How to Run the Application
You can start both the backend and frontend services using the provided batch file or by running them manually in separate terminals.
Method 1: Automatic Startup (Windows)
Simply double-click the batch file in the root folder:
run_local_react_ui.batThis script will:
- Initialize the Python virtual environment (
.venv) if it doesn't exist. - Install Python backend dependencies.
- Launch the FastAPI backend on
http://localhost:8000. - Install frontend npm dependencies.
- Launch the React dev server on
http://localhost:5173.
Method 2: Manual Startup (All Platforms)
To run backend and frontend separately, open two terminal windows:
1. Start the FastAPI Backend
# Navigate to the backend directory
cd backend
# Create a virtual environment (if not already done)
python -m venv .venv
# Activate the virtual environment
#{
# Windows PowerShell:
.\.venv\Scripts\Activate.ps1
# Windows CMD:
.\.venv\Scripts\activate.bat
# Linux/macOS:
source .venv/bin/activate
#}
# Install requirements
pip install -r requirements.txt
# Start the backend server
uvicorn main:app --reload --port 8000The API will be available at `http://127.0.0.1:8000` (docs at `http://127.0.0.1:8000/docs`).
2. Start the React Frontend
# Navigate to the frontend directory
cd frontend
# Install package dependencies
npm install
# Start Vite development server
npm run devThe user interface will be available at `http://localhost:5173`.
๐ Features & Methodology
- Excel Data Import: Uploads Excel sheets containing numeric columns matching
LengthandWidth(case-insensitive). - Equivalent Diameter Calculation: Computes equivalent diameter for each particle/inclusion: $$X_i = \sqrt{\text{Length} \times \text{Width}}$$
- Gumbel Fitting (Linear Regression): Sorts equivalent diameters $Xi$ on the X-axis and plots them against Gumbel reduced variable $Gi$ on the Y-axis: $$Pi = \frac{i}{n + 1}$$ $$Gi = -\ln(-\ln(P_i))$$
- Extreme Value Prediction: Computes the return period $T$, target Gumbel value $G$, and predicted maximum equivalent diameter: $$X_{max} = \frac{G - \text{intercept}}{\text{slope}}$$
- Interactive Visualization: Generates high-quality charts showing measured data points, the regression line, and the predicted maximum inclusion diameter.
๐ Free Hosting Options
Since the application is containerized using the provided Dockerfile, you can easily host it for free on several platforms.
Option A: Hugging Face Spaces (Recommended & 100% Free)
Hugging Face Spaces offers free Docker hosting that remains online and does not sleep as aggressively as other free tiers.
- Create a free account on Hugging Face.
- Create a new Space:
- Choose any name you like.
- Select Docker as the SDK.
- Select the Blank template.
- Choose Public or Private visibility.
- Once created, upload all the repository files (including the
Dockerfile,backend,frontend, etc.) directly via Git or the web interface. - The space will automatically read the metadata at the top of this
README.md, build the container, and host the app.
Option B: Render (Free Web Service)
Render is a cloud hosting platform that can deploy directly from your GitHub repository.
- Create a free account on Render.
- Click New + and select Web Service.
- Connect your GitHub repository.
- Set the following configurations:
- Runtime:
Docker - Branch:
main(or whichever branch you push to) - Free Instance Type
- Render will automatically build the
Dockerfileand deploy the application. (Note: Render free services will spin down/sleep after 15 minutes of inactivity. The first request after a sleep period can take ~50 seconds to spin back up).
Option C: Koyeb (Free Micro Instance)
Koyeb is a container-based developer platform that offers a free tier.
- Create a free account on Koyeb.
- Create a new service and connect your GitHub repository.
- Select Docker as the builder.
- Set the port to
8000and deploy.
