Delete files decode.py with huggingface_hub
Browse files
decode.py
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
from flask import Flask, request, jsonify
|
| 2 |
-
from transformers import AutoTokenizer
|
| 3 |
-
|
| 4 |
-
app = Flask(__name__)
|
| 5 |
-
|
| 6 |
-
# Load the tokenizer for decoding
|
| 7 |
-
tokenizer = AutoTokenizer.from_pretrained("verbalyze/Text2Text_Conversation_Pretrained_V2__model")
|
| 8 |
-
|
| 9 |
-
@app.route('/decode', methods=['POST'])
|
| 10 |
-
def decode():
|
| 11 |
-
data = request.json
|
| 12 |
-
output_ids = data.get('output_ids')
|
| 13 |
-
|
| 14 |
-
# Decode the output IDs
|
| 15 |
-
generated_text = tokenizer.decode(output_ids[0], skip_special_tokens=True)
|
| 16 |
-
|
| 17 |
-
return jsonify({'generated_text': generated_text})
|
| 18 |
-
|
| 19 |
-
if __name__ == '__main__':
|
| 20 |
-
app.run(host='0.0.0.0', port=5003)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|