Skip to content

Instantly share code, notes, and snippets.

@ashmibanerjee
Created July 10, 2022 22:08
Show Gist options
  • Save ashmibanerjee/0a7015d45feb5a9b052973dea41d1799 to your computer and use it in GitHub Desktop.
Save ashmibanerjee/0a7015d45feb5a9b052973dea41d1799 to your computer and use it in GitHub Desktop.
from locust import HttpUser, task, between
from src.app.app import Img
import json
class PerformanceTests(HttpUser):
wait_time = between(1, 3)
@task(1)
def test_tf_predict(self):
sample = Img(img_url="https://raw.githubusercontent.com/pytorch/hub/master/images/dog.jpg")
headers = {'Accept': 'application/json',
'Content-Type': 'application/json'}
res = self.client.post("/predict/tf/",
data=json.dumps(sample.dict()),
headers=headers)
print("res", res.json())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment