File size: 2,231 Bytes
ce3e778
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash

BASE_URL="http://localhost:7860"

echo "=== Testing Style GPT API (Local) ==="
echo "Base URL: $BASE_URL"
echo "Make sure the server is running: uvicorn app:app --host 0.0.0.0 --port 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 ==="