File size: 431 Bytes
c906021
 
732d546
c906021
54004ae
ff60146
 
54004ae
 
 
 
c906021
 
54004ae
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from flask import Flask, request, jsonify
from transformers import pipeline

app = Flask(__name__)
model = pipeline('text-generation', model='Erfan11/Neuracraft')

@app.route('/generate', methods=['POST'])
def generate_text():
    input_text = request.json.get('input_text', '')
    result = model(input_text, max_length=100)
    return jsonify(result)

if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=5000)