|
|
#!/bin/bash |
|
|
|
|
|
if [ -z "$1" ]; then |
|
|
BASE_URL="https://nexusbert-style.hf.space" |
|
|
else |
|
|
BASE_URL="$1" |
|
|
fi |
|
|
|
|
|
echo "=== Testing Style GPT API ===" |
|
|
echo "Base URL: $BASE_URL" |
|
|
echo "Usage: $0 [base_url]" |
|
|
echo "Example: $0 http://localhost:7860" |
|
|
echo "" |
|
|
|
|
|
echo "1. Testing GET / (Root endpoint)" |
|
|
curl -X GET "$BASE_URL/" \ |
|
|
-H "Content-Type: application/json" \ |
|
|
-w "\nHTTP Status: %{http_code}\n\n" |
|
|
|
|
|
echo "2. Testing GET /health" |
|
|
curl -X GET "$BASE_URL/health" \ |
|
|
-H "Content-Type: application/json" \ |
|
|
-w "\nHTTP Status: %{http_code}\n\n" |
|
|
|
|
|
echo "3. Testing POST /text (Text-only chat)" |
|
|
curl -X POST "$BASE_URL/text" \ |
|
|
-H "Content-Type: application/json" \ |
|
|
-d '{ |
|
|
"message": "Hello, what colors go well with blue?", |
|
|
"session_id": "test-session-1" |
|
|
}' \ |
|
|
-w "\nHTTP Status: %{http_code}\n\n" |
|
|
|
|
|
echo "4. Testing POST /chat (Chat with optional images - text only)" |
|
|
curl -X POST "$BASE_URL/chat" \ |
|
|
-H "Content-Type: application/json" \ |
|
|
-d '{ |
|
|
"message": "What should I wear with a black jacket?", |
|
|
"session_id": "test-session-2", |
|
|
"images": null |
|
|
}' \ |
|
|
-w "\nHTTP Status: %{http_code}\n\n" |
|
|
|
|
|
echo "5. Testing POST /chat (Chat with wardrobe)" |
|
|
curl -X POST "$BASE_URL/chat" \ |
|
|
-H "Content-Type: application/json" \ |
|
|
-d '{ |
|
|
"message": "Suggest an outfit for a casual meeting", |
|
|
"session_id": "test-session-3", |
|
|
"wardrobe": [ |
|
|
{ |
|
|
"category": "shirt", |
|
|
"style": "casual", |
|
|
"color": "white", |
|
|
"brand": "Zara", |
|
|
"name": "White casual shirt" |
|
|
}, |
|
|
{ |
|
|
"category": "pants", |
|
|
"style": "formal", |
|
|
"color": "navy", |
|
|
"brand": "H&M", |
|
|
"name": "Navy trousers" |
|
|
} |
|
|
] |
|
|
}' \ |
|
|
-w "\nHTTP Status: %{http_code}\n\n" |
|
|
|
|
|
echo "6. Testing POST /chat/upload (File upload - text only)" |
|
|
curl -X POST "$BASE_URL/chat/upload" \ |
|
|
-F "message=What colors match with red?" \ |
|
|
-F "session_id=test-session-4" \ |
|
|
-F "wardrobe=[]" \ |
|
|
-w "\nHTTP Status: %{http_code}\n\n" |
|
|
|
|
|
echo "7. Testing POST /chat/upload/stream (Streaming - text only)" |
|
|
curl -X POST "$BASE_URL/chat/upload/stream" \ |
|
|
-F "message=Tell me about fashion trends" \ |
|
|
-F "session_id=test-session-5" \ |
|
|
-F "wardrobe=[]" \ |
|
|
--no-buffer \ |
|
|
-w "\nHTTP Status: %{http_code}\n\n" |
|
|
|
|
|
echo "=== All tests completed ===" |
|
|
|
|
|
|