File size: 1,095 Bytes
e0ea972
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import requests
import os
import sys

def test_api():
    url = "http://127.0.0.1:8000/generate-transition"
    
    video_a_path = 'tests/scene_a.mp4'
    video_c_path = 'tests/scene_c.mp4'
    
    if not os.path.exists(video_a_path) or not os.path.exists(video_c_path):
        print("Error: Test videos not found. Run create_assets.py first.")
        sys.exit(1)

    files = {
        'video_a': ('scene_a.mp4', open(video_a_path, 'rb'), 'video/mp4'),
        'video_c': ('scene_c.mp4', open(video_c_path, 'rb'), 'video/mp4')
    }
    data = {'prompt': 'Test transition'}

    print(f"Sending POST request to {url}...")
    try:
        response = requests.post(url, files=files, data=data)
        print(f"Status Code: {response.status_code}")
        if response.status_code == 200:
            print(f"Success! Response: {response.json()}")
        else:
            print(f"Failed. Response: {response.text}")
    except Exception as e:
        print(f"Connection Failed: {e}")
        print("Make sure the server is running on port 8000.")

if __name__ == "__main__":
    test_api()