File size: 1,520 Bytes
f8731a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Makefile for Rice Anomaly Detection UI Project

# Variables
VENV_DIR = venv
PYTHON = python3
PIP = $(VENV_DIR)/bin/pip
APP = app.py  # Replace with the name of your main script file

# Default target
.PHONY: all
all: setup install run

# Create virtual environment
.PHONY: setup
setup:
	@echo "Creating virtual environment..."
	$(PYTHON) -m venv $(VENV_DIR)
	@echo "Virtual environment created."

# Install dependencies
.PHONY: install
install: setup
	@echo "Installing dependencies..."
	$(PIP) install --upgrade pip
	$(PIP) install -r requirements.txt
	@echo "Dependencies installed."

# Run the Gradio app
.PHONY: run
run:
	@echo "Running the Gradio app..."
	$(VENV_DIR)/bin/python $(APP)

# Clean up virtual environment and generated files
.PHONY: clean
clean:
	@echo "Cleaning up..."
	rm -rf $(VENV_DIR)
	find . -type f -name "*.pyc" -delete
	find . -type d -name "__pycache__" -delete
	@echo "Cleaned up."

# Rebuild everything from scratch
.PHONY: rebuild
rebuild: clean all

# Help message
.PHONY: help
help:
	@echo "Makefile for Rice Anomaly Detection UI Project"
	@echo ""
	@echo "Targets:"
	@echo "  all       : Set up environment, install dependencies, and run the app (default)"
	@echo "  setup     : Create a virtual environment"
	@echo "  install   : Install dependencies from requirements.txt"
	@echo "  run       : Run the Gradio app"
	@echo "  clean     : Remove virtual environment and generated files"
	@echo "  rebuild   : Clean and rebuild everything"
	@echo "  help      : Show this help message"