mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
Update networking.py
This commit is contained in:
parent
d8a00eca55
commit
177b47eeed
@ -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