Thebull commited on
Commit
763bed6
·
verified ·
1 Parent(s): 021cb52

Create app.py

Browse files

from flask import Flask, request, jsonify
from transformers import pipeline

app = Flask(__name__)



@app
.route('/generate', methods=['POST'])
def generate():
data = request.get_json()
text = data['text']

# Utiliza un modelo de Hugging Face
generator = pipeline("text-generation")
response = generator(text, max_length=50, do_sample=False)[0]['generated_text']

return jsonify({"response": response})

if __name__ == '__main__':
app.run(debug=True)

Files changed (1) hide show
  1. app.py +0 -0
app.py ADDED
File without changes