Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,5 +1,97 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
sdk: gradio
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Angle Measurement v2
|
| 3 |
sdk: gradio
|
| 4 |
+
sdk_version : 4.0.0
|
| 5 |
+
app_file : angle_detection_app.py
|
| 6 |
+
colorFrom: indigo
|
| 7 |
+
colorTo: gray
|
| 8 |
+
pinned: true
|
| 9 |
+
---
|
| 10 |
+
# Angle Detection App
|
| 11 |
+
|
| 12 |
+
This app detects bends in images and measures angles between them. It's particularly useful for analyzing geometric patterns and measuring angles in technical drawings or diagrams.
|
| 13 |
+
|
| 14 |
+
## Features
|
| 15 |
+
|
| 16 |
+
- Upload images in various formats (JPEG, PNG, HEIC)
|
| 17 |
+
- Automatic bend detection
|
| 18 |
+
- Angle measurement between bends
|
| 19 |
+
- Adjustable parameters for fine-tuning detection
|
| 20 |
+
- Real-time visualization with bend points and angle measurements
|
| 21 |
+
|
| 22 |
+
## Usage
|
| 23 |
+
|
| 24 |
+
1. Upload an image using the file uploader
|
| 25 |
+
2. Adjust the algorithm parameters if needed:
|
| 26 |
+
- Blur Kernel Size: Controls image smoothing
|
| 27 |
+
- Canny Thresholds: Edge detection sensitivity
|
| 28 |
+
- Dilation Kernel Size: Edge thickening
|
| 29 |
+
- Hough Threshold: Line detection sensitivity
|
| 30 |
+
- Line Length/Gap: Minimum line length and maximum gap between line segments
|
| 31 |
+
- Bend Threshold: Distance threshold for bend detection
|
| 32 |
+
3. Click "Process Image" to analyze the image
|
| 33 |
+
4. View the results with detected bends and measured angles
|
| 34 |
+
|
| 35 |
+
## Example Images
|
| 36 |
+
|
| 37 |
+
The app includes example images to help you get started. Try them out to see how the angle detection works with different types of images.
|
| 38 |
+
|
| 39 |
+
## Technical Details
|
| 40 |
+
|
| 41 |
+
The app uses OpenCV for image processing and edge detection, with the following main steps:
|
| 42 |
+
1. Image preprocessing (grayscale conversion and blur)
|
| 43 |
+
2. Edge detection using Canny algorithm
|
| 44 |
+
3. Line detection using Hough transform
|
| 45 |
+
4. Bend point identification
|
| 46 |
+
5. Angle calculation between consecutive bends
|
| 47 |
+
|
| 48 |
+
## Local Deployment
|
| 49 |
+
|
| 50 |
+
1. Install dependencies:
|
| 51 |
+
```bash
|
| 52 |
+
pip install -r requirements.txt
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
2. Run the app:
|
| 56 |
+
```bash
|
| 57 |
+
python angle_detection_app.py
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
3. Open your browser and navigate to the URL shown in the terminal (typically http://127.0.0.1:7860)
|
| 61 |
+
|
| 62 |
+
## Hugging Face Spaces Deployment
|
| 63 |
+
|
| 64 |
+
1. Create a new Space on Hugging Face:
|
| 65 |
+
- Go to https://huggingface.co/spaces
|
| 66 |
+
- Click "New Space"
|
| 67 |
+
- Choose "Gradio" as the SDK
|
| 68 |
+
- Give your space a name
|
| 69 |
+
|
| 70 |
+
2. Push your code to the Space:
|
| 71 |
+
```bash
|
| 72 |
+
git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
|
| 73 |
+
cd YOUR_SPACE_NAME
|
| 74 |
+
# Copy your files here
|
| 75 |
+
git add .
|
| 76 |
+
git commit -m "Initial commit"
|
| 77 |
+
git push
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
## Docker Deployment
|
| 81 |
+
|
| 82 |
+
1. Build the Docker image:
|
| 83 |
+
```bash
|
| 84 |
+
docker build -t angle-detection-app .
|
| 85 |
+
```
|
| 86 |
+
|
| 87 |
+
2. Run the container:
|
| 88 |
+
```bash
|
| 89 |
+
docker run -p 7860:7860 angle-detection-app
|
| 90 |
+
```
|
| 91 |
+
|
| 92 |
+
3. Access the app at http://localhost:7860
|
| 93 |
+
|
| 94 |
+
## Requirements
|
| 95 |
+
|
| 96 |
+
- Python 3.8+
|
| 97 |
+
- See requirements.txt for Python package dependencies
|