Spaces:
Sleeping
Sleeping
Florin Bobiș
commited on
Commit
•
6669610
1
Parent(s):
58cf8b2
changes
Browse files- api/index.py +2 -5
- test.http +2 -3
api/index.py
CHANGED
@@ -3,8 +3,8 @@ from transformers import MT5ForConditionalGeneration, T5Tokenizer
|
|
3 |
|
4 |
app = Flask(__name__)
|
5 |
|
6 |
-
model = MT5ForConditionalGeneration.from_pretrained('iliemihai/mt5-base-romanian-diacritics')
|
7 |
-
tokenizer = T5Tokenizer.from_pretrained('iliemihai/mt5-base-romanian-diacritics', legacy=False)
|
8 |
|
9 |
@app.route('/generate', methods=['POST'])
|
10 |
def generate_text():
|
@@ -15,6 +15,3 @@ def generate_text():
|
|
15 |
outputs = model.generate(input_ids=inputs["input_ids"], attention_mask=inputs["attention_mask"])
|
16 |
output = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
17 |
return jsonify({'output': output})
|
18 |
-
|
19 |
-
# if __name__ == '__main__':
|
20 |
-
# app.run(host="0.0.0.0", debug=True, port=8082, threaded=True)
|
|
|
3 |
|
4 |
app = Flask(__name__)
|
5 |
|
6 |
+
model = MT5ForConditionalGeneration.from_pretrained('iliemihai/mt5-base-romanian-diacritics', cache_dir='cache/')
|
7 |
+
tokenizer = T5Tokenizer.from_pretrained('iliemihai/mt5-base-romanian-diacritics', legacy=False, cache_dir='cache/')
|
8 |
|
9 |
@app.route('/generate', methods=['POST'])
|
10 |
def generate_text():
|
|
|
15 |
outputs = model.generate(input_ids=inputs["input_ids"], attention_mask=inputs["attention_mask"])
|
16 |
output = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
17 |
return jsonify({'output': output})
|
|
|
|
|
|
test.http
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
-
POST
|
2 |
-
Content-Type: application/json
|
3 |
|
4 |
{
|
5 |
-
"input_text": "
|
6 |
}
|
|
|
1 |
+
POST http://94.101.98.71:5000/generate
|
|
|
2 |
|
3 |
{
|
4 |
+
"input_text": "cat de multe as vrea sa-ti spun tie"
|
5 |
}
|