mirror of
https://github.com/gradio-app/gradio.git
synced 2024-11-27 01:40:20 +08:00
Merge branch 'master' of https://github.com/gradio-app/gradio
This commit is contained in:
commit
3ba22a9fd9
@ -151,11 +151,13 @@ def serve_files_in_background(interface, port, directory_to_serve=None, server_n
|
||||
if self.path == "/api/predict/":
|
||||
# Make the prediction.
|
||||
self._set_headers()
|
||||
print("in")
|
||||
data_string = self.rfile.read(
|
||||
int(self.headers["Content-Length"]))
|
||||
msg = json.loads(data_string)
|
||||
raw_input = msg["data"]
|
||||
prediction, durations = interface.process(raw_input)
|
||||
print("prediction")
|
||||
|
||||
output = {"data": prediction, "durations": durations}
|
||||
self.wfile.write(json.dumps(output).encode())
|
||||
@ -262,4 +264,4 @@ def url_ok(url):
|
||||
r = requests.head(url)
|
||||
return r.status_code == 200
|
||||
except ConnectionError:
|
||||
return False
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user