|
from flask import Flask, request, jsonify |
|
from transformers import AutoTokenizer, AutoModel |
|
|
|
app = Flask(__name__) |
|
|
|
|
|
try: |
|
tokenizer = AutoTokenizer.from_pretrained('stepfun-ai/GOT-OCR2_0', revision='cf6b7386bc89a54f09785612ba74cb12de6fa17c', trust_remote_code=True) |
|
model = AutoModel.from_pretrained('stepfun-ai/GOT-OCR2_0', revision='cf6b7386bc89a54f09785612ba74cb12de6fa17c', trust_remote_code=True) |
|
except Exception as e: |
|
print(f"Error loading model and tokenizer: {e}") |
|
|
|
@app.route('/predict', methods=['POST']) |
|
def predict(): |
|
|
|
data = request.json |
|
|
|
|
|
|
|
return jsonify({"message": "Prediction made successfully!"}) |
|
|
|
if __name__ == "__main__": |
|
app.run(host='0.0.0.0', port=5000) |
|
|