Posts

स्वयं सहायता समूह क्या है?

from flask import Flask, render_template, request from PIL import Image import pytesseract app = Flask(__name__) @app.route('/') def index(): return render_template('index.html') @app.route('/convert', methods=['GET', 'POST']) def convert(): if request.method == 'POST': # Get the uploaded image file image_file = request.files['image'] # Read the image using PIL image = Image.open(image_file) # Convert the image to grayscale image = image.convert('L') # Perform OCR using pytesseract extracted_text = pytesseract.image_to_string(image) return render_template('result.html', text=extracted_text) else: return 'Method Not Allowed', 405 if __name__ == '__main__': app.run(debug=True)

Rate this article

Post a Comment