Spaces:
Runtime error
Runtime error
Created bash script to test
Browse filesFiles changed (3)
- .gitignore+1
- test_api.py+2-2
- test_api.shAdded+61
98 unmodified lines9910010198 unmodified lines**/*secret***/*private*/call_history.csv98 unmodified lines9910010110298 unmodified lines**/*secret***/*private*/call_history.csv/call_history.txt
10 unmodified lines111213141516171810 unmodified linesheaders = {"Content-Type": "application/json; charset=utf-8"}# base_url = "https://tangibleai-mathtext.hf.space/run/{endpoint}"base_url = "http://localhost:7860/run/{endpoint}"data_list_1 = {"endpoint": "text2int",10 unmodified lines111213141516171810 unmodified linesheaders = {"Content-Type": "application/json; charset=utf-8"}base_url = "https://tangibleai-mathtext.hf.space/run/{endpoint}"# base_url = "http://localhost:7860/run/{endpoint}"data_list_1 = {"endpoint": "text2int",
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061#! /bin/env bash
data_list_1() { responses=( "one hundred forty five" "twenty thousand nine hundred fifty" "one hundred forty five" "nine hundred eighty three" "five million" ) echo "${responses[$1]}"}
data_list_2() { responses=( "Totally agree" "I like it" "No more" "I am not sure" "Never" ) echo "${responses[$1]}"}
text2int="https://tangibleai-mathtext.hf.space/run/text2int"text2intpreprocessed="https://tangibleai-mathtext.hf.space/run/text2int-preprocessed"sentimentanalysis="https://tangibleai-mathtext.hf.space/run/sentiment-analysis"
test_endpoint() { start_=$(date +%s.%N) response=$(curl --silent -X POST "$1" -H 'Content-Type: application/json' -d "$2") end_=$(date +%s.%N) diff=$(echo "$end_ - $start_" | bc) printf " endpoint:%s\n data:%s delay:%s:\n %s\n" "$1" "$2" "$diff" "$response"}
echo "start: $(date)"
for i in {1..20}; do random_value=$((RANDOM % 5)) text=$(data_list_1 $random_value) data='{"data": ["'$text'"]}' test_endpoint "$text2int" "$data" >>call_history.txt &done
for i in {1..20}; do random_value=$((RANDOM % 5)) text=$(data_list_1 $random_value) data='{"data": ["'$text'"]}' test_endpoint "$text2intpreprocessed" "$data" >>call_history.txt &done
for i in {1..20}; do random_value=$((RANDOM % 5)) text=$(data_list_2 $random_value) data='{"data": ["'$text'"]}' test_endpoint "$sentimentanalysis" "$data" >>call_history.txt &done
waitecho "end: $(date)".gitignore+1
test_api.py+2-2
test_api.shAdded+61