Open anotherjesse opened 7 months ago
A simple http server I wrote to test this
from http.server import BaseHTTPRequestHandler, HTTPServer
import os
class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
def _file_path(self):
path = os.getcwd() + self.path
print(path)
return path
def do_GET(self):
file_path = self._file_path()
if not os.path.exists(file_path):
self.send_response(404)
self.end_headers()
return
with open(file_path, 'rb') as file:
self.send_response(200)
self.send_header('Content-type', 'text/plain')
self.end_headers()
self.wfile.write(file.read())
def do_PUT(self):
file_path = self._file_path()
file_length = int(self.headers['Content-Length'])
with open(file_path, 'wb') as file:
file.write(self.rfile.read(file_length))
self.send_response(200)
self.end_headers()
def run(server_class=HTTPServer, handler_class=SimpleHTTPRequestHandler):
server_address = ('', 4321)
httpd = server_class(server_address, handler_class)
httpd.serve_forever()
if __name__ == '__main__':
run()
I checked the code, when using async prediction, output_file_prefix is ignored. They didn't even use it. I want to add a uuid in the path, and I don't know how to do it...
@anotherjesse Thank you for the documentation!
How can you start cog with the --upload-url
flag? When I try to add it, I always get unknown flag: --upload-url
.
I use docker to run it, just like it is documented in getting-started
Hi there. Am I to infer from this thread that replicate's previously default upload behavior has changed?
Asking because of this issue: https://github.com/replicate/cog/issues/1759
@platform-kit In the case of #1759, I think that's a problem with the model itself rather than a change in upload behavior.
cog still supports upload files outside of replicate :yay:
--upload-url=http://host/:port/basepath
host:port
http://host/:port/basepath
and then include any additional information to uniqueifyhttp://host/:port/basepath/{uuid}-
where the client has to decide the uuid