OpenTransformer commited on
Commit
3697382
·
verified ·
1 Parent(s): 6c84677

Upload raw_relay.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. raw_relay.py +15 -0
raw_relay.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ from flask import Flask, request
3
+ import os
4
+ app = Flask(__name__)
5
+
6
+ @app.route('/raw', methods=['POST'])
7
+ def raw_upload():
8
+ path = request.headers.get('X-Path', '/tmp/upload')
9
+ os.makedirs(os.path.dirname(path) or '/tmp', exist_ok=True)
10
+ with open(path, 'wb') as f:
11
+ f.write(request.data)
12
+ return {"status": "ok", "path": path, "size": len(request.data)}
13
+
14
+ if __name__ == '__main__':
15
+ app.run(host='0.0.0.0', port=5000)