Florin Bobiș commited on
Commit
f236056
1 Parent(s): 8fb9a6e
Files changed (4) hide show
  1. .gitignore +1 -0
  2. api/index.py → index.py +2 -3
  3. test.http +1 -1
  4. vercel.json +17 -2
.gitignore CHANGED
@@ -158,3 +158,4 @@ cython_debug/
158
  # and can be added to the global gitignore or merged into this file. For a more nuclear
159
  # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
  #.idea/
 
 
158
  # and can be added to the global gitignore or merged into this file. For a more nuclear
159
  # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
  #.idea/
161
+ .vercel
api/index.py → index.py RENAMED
@@ -1,6 +1,5 @@
1
  from flask import Flask, request, jsonify
2
  from transformers import MT5ForConditionalGeneration, T5Tokenizer
3
- import torch
4
 
5
  app = Flask(__name__)
6
 
@@ -17,5 +16,5 @@ def generate_text():
17
  output = tokenizer.decode(outputs[0], skip_special_tokens=True)
18
  return jsonify({'output': output})
19
 
20
- if __name__ == '__main__':
21
- app.run(debug=False)
 
1
  from flask import Flask, request, jsonify
2
  from transformers import MT5ForConditionalGeneration, T5Tokenizer
 
3
 
4
  app = Flask(__name__)
5
 
 
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)
test.http CHANGED
@@ -1,4 +1,4 @@
1
- POST http://localhost:5000/generate
2
  Content-Type: application/json
3
 
4
  {
 
1
+ POST https://dia-critic.vercel.app/generate
2
  Content-Type: application/json
3
 
4
  {
vercel.json CHANGED
@@ -1,3 +1,18 @@
1
  {
2
- "rewrites": [{ "source": "/(.*)", "destination": "/api/index" }]
3
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  {
2
+ "version": 2,
3
+ "builds": [
4
+ {
5
+ "src": "/index.py",
6
+ "use": "@vercel/python",
7
+ "config": {
8
+ "maxLambdaSize": "150mb"
9
+ }
10
+ }
11
+ ],
12
+ "routes": [
13
+ {
14
+ "src": "/(.*)",
15
+ "dest": "/index.py"
16
+ }
17
+ ]
18
+ }