analogcaption-0.1.0
توضیحات
A Package that uses AI to give users the caption of an image
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | analogcaption-0.1.0 |
| نام | analogcaption |
| نسخه کتابخانه | 0.1.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Analog Teams |
| ایمیل نویسنده | james@analogteams.com |
| آدرس صفحه اصلی | https://bitbucket.org/Lormenyoh/image-caption-generator/src/master/ |
| آدرس اینترنتی | https://pypi.org/project/analogcaption/ |
| مجوز | The MIT License |
**Analog Image Caption Package**
This is a Python package that helps give caption to your images, it is built on the Flickr_8k Dataset and trained with the Xception pre-trained model.
---
## How to try this package ?
This package is very easy to use and has 2 fuctions which are:
1. ***extract_features()*** this function simply take the image and extract the features from it.
2. ***generate_desc()*** this function now generates a description for the Image.
---
## Demo in a flask app
```
@app.route("/generateCaption", methods=["POST"])
def generateCaption():
image = request.files['image']
img = image.read()
# convert string of image data to uint8
nparr = np.fromstring(img, np.uint8)
# decode image
img = cv2.imdecode(nparr, cv2.IMREAD_COLOR)
img = cv2.resize(img, (224, 224))
photo = extract_features(img)
# generate description
caption = generate_desc(model, tokenizer, photo, max_length)
return render_template("results.html", image=image, caption=caption)
```
---
## Demo in a python script
```
#import image and extract feature
photo = extract_features(img_path)
img = Image.open(img_path)
description = generate_desc(model, tokenizer, photo, max_length)
print("\n\n")
print(description)
plt.imshow(img)
```
Hope this helps you understand the package and use it in a project. We are currently working on more cool features and will do an update when we're done.
نحوه نصب
نصب پکیج whl analogcaption-0.1.0:
pip install analogcaption-0.1.0.whl
نصب پکیج tar.gz analogcaption-0.1.0:
pip install analogcaption-0.1.0.tar.gz