Delete files model.py with huggingface_hub
Browse files
model.py
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
from flask import Flask, request, jsonify
|
2 |
-
from transformers import AutoModelForCausalLM
|
3 |
-
import torch
|
4 |
-
|
5 |
-
app = Flask(__name__)
|
6 |
-
|
7 |
-
# Load the model
|
8 |
-
model = AutoModelForCausalLM.from_pretrained("verbalyze/Text2Text_Conversation_Pretrained_V2__model")
|
9 |
-
|
10 |
-
@app.route('/generate', methods=['POST'])
|
11 |
-
def generate():
|
12 |
-
data = request.json
|
13 |
-
input_ids = torch.tensor(data.get('input_ids'))
|
14 |
-
|
15 |
-
# Generate text from input IDs
|
16 |
-
output_ids = model.generate(input_ids, max_length=50)
|
17 |
-
|
18 |
-
return jsonify({'output_ids': output_ids.tolist()})
|
19 |
-
|
20 |
-
if __name__ == '__main__':
|
21 |
-
app.run(host='0.0.0.0', port=5002)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|