detectAI / backend /repro_large.py
vivek1192's picture
Setup CI/CD for Hugging Face
171eb01
import requests
import time
url = "http://127.0.0.1:8000/api/report/"
# Create a large text payload (approx 3000 words)
large_text = "Analysis of complex AI systems requires robust testing. " * 300
data = {
"text": large_text,
"score": 98.5,
"label": "AI Generated"
}
start_time = time.time()
try:
print(f"Sending request with {len(large_text)} characters...")
response = requests.post(url, json=data, timeout=60) # 60s timeout
duration = time.time() - start_time
if response.status_code == 200:
print(f"Success! Took {duration:.2f}s")
with open("repro_large.pdf", "wb") as f:
f.write(response.content)
else:
print(f"Failed: {response.status_code}")
print(response.text[:1000])
except Exception as e:
print(f"Error after {time.time() - start_time:.2f}s: {e}")