Spaces:
Sleeping
Sleeping
dhavalsavalia
commited on
Commit
•
ae77f8e
1
Parent(s):
2bec1b9
Optimize Server Handeling and Requests payload
Browse files- request.py +7 -2
- server.py +4 -1
request.py
CHANGED
@@ -1,8 +1,13 @@
|
|
1 |
import requests
|
2 |
|
3 |
# URL
|
4 |
-
url = 'http://localhost:5000/api'
|
5 |
|
6 |
# Change the value of experience that you want to test
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
8 |
print(r.json())
|
|
|
1 |
import requests
|
2 |
|
3 |
# URL
|
4 |
+
url = 'http://localhost:5000/api/'
|
5 |
|
6 |
# Change the value of experience that you want to test
|
7 |
+
payload = {
|
8 |
+
'exp':1.8
|
9 |
+
}
|
10 |
+
|
11 |
+
r = requests.post(url,json=payload)
|
12 |
+
|
13 |
print(r.json())
|
server.py
CHANGED
@@ -29,4 +29,7 @@ def predict():
|
|
29 |
return jsonify(output)
|
30 |
|
31 |
if __name__ == '__main__':
|
32 |
-
|
|
|
|
|
|
|
|
29 |
return jsonify(output)
|
30 |
|
31 |
if __name__ == '__main__':
|
32 |
+
try:
|
33 |
+
app.run(port=5000, debug=True)
|
34 |
+
except:
|
35 |
+
print("Server is exited unexpectedly. Please contact server admin.")
|