Spaces:
Sleeping
Sleeping
Commit
·
b9d0fcc
1
Parent(s):
5ec100d
Fix readme
Browse files
README.md
CHANGED
|
@@ -1,60 +1,11 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
```
|
| 13 |
-
## Running the Application
|
| 14 |
-
Run the application with the following command:
|
| 15 |
-
|
| 16 |
-
```bash
|
| 17 |
-
python3 -m flask run --host=0.0.0.0
|
| 18 |
-
```
|
| 19 |
-
The application should start and be accessible at localhost:5000.
|
| 20 |
-
|
| 21 |
-
## API Endpoints
|
| 22 |
-
The application exposes two API endpoints:
|
| 23 |
-
|
| 24 |
-
```/monet```: POST endpoint which accepts an image file and returns the image stylized in the style of Monet paintings.
|
| 25 |
-
|
| 26 |
-
```/upscale```: POST endpoint which accepts an image file and returns the upscaled version of the image.
|
| 27 |
-
#File Structure
|
| 28 |
-
```app.py```: This is the main application file which runs the Flask application and defines the API endpoints.
|
| 29 |
-
```models/models.py```: This file contains the model loading and prediction functions.
|
| 30 |
-
## models/models.py
|
| 31 |
-
```tensor_to_image(tensor)```: Converts a TensorFlow tensor to an image and saves it to 'upscaled_image.jpg'.
|
| 32 |
-
|
| 33 |
-
```request_to_image(request)```: Converts a Flask request object containing an image to a numpy array.
|
| 34 |
-
|
| 35 |
-
```_monet(image, upscale=False)```: Accepts an image as input and returns the image stylized in the style of Monet paintings.
|
| 36 |
-
|
| 37 |
-
```_upscale(image)```: Accepts an image as input and returns the upscaled version of the image.
|
| 38 |
-
## Sending Requests to the API
|
| 39 |
-
For both endpoints, the image file should be included in the request as form data with the key 'image'. Here is an example using curl:
|
| 40 |
-
|
| 41 |
-
```bash
|
| 42 |
-
Copy code
|
| 43 |
-
curl -X POST -F "image=@<image-file-path>" http://localhost:5000/monet
|
| 44 |
-
```
|
| 45 |
-
```bash
|
| 46 |
-
Copy code
|
| 47 |
-
curl -X POST -F "image=@<image-file-path>" http://localhost:5000/upscale
|
| 48 |
-
Replace <image-file-path> with the path to your image file.
|
| 49 |
-
```
|
| 50 |
-
## Notes
|
| 51 |
-
The model files for the Monet style transfer (models/monet_generator) are not included in this repository. You need to download them separately and place them in the correct location.
|
| 52 |
-
Contributing
|
| 53 |
-
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
|
| 54 |
-
|
| 55 |
-
## License
|
| 56 |
-
MIT
|
| 57 |
-
|
| 58 |
-
docker buildx build --platform linux/amd64,linux/arm64 -t joshuapeddle/imagetransfer-server:0.0.2 --push .
|
| 59 |
-
|
| 60 |
-
docker run -p 5000:5000 joshuapeddle/imagetransfer-server:0.0.2
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: ImageTransfer Server
|
| 3 |
+
emoji: 🐠
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: indigo
|
| 6 |
+
sdk: docker
|
| 7 |
+
pinned: false
|
| 8 |
+
license: openrail
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|