SexBot / fetishTest /test.py
Pew404's picture
Upload folder using huggingface_hub
318db6e verified
raw
history blame contribute delete
667 Bytes
import subprocess
import json, httpx
# API的URL
url = "http://localhost:8002/fetish"
# 准备要发送的数据 生成A-D之间的十个随机答案
import random
answers = []
for _ in range(10):
answers.append(random.choice(["A", "B", "C", "D"]))
data = {
"answer": answers # 替换为实际的答案列表
}
# 将数据转换为JSON字符串
data_json = json.dumps(data)
# 构建curl命令
curl_command = [
"curl", "-X", "POST", "-H", "Content-Type: application/json", "-d", data_json, url
]
# 执行curl命令
process = subprocess.run(curl_command, capture_output=True, text=True)
# 打印返回的结果
print(process.stdout)
print(data_json)