20 lines
635 B
Python
20 lines
635 B
Python
import requests
|
|
import time
|
|
|
|
print("Waiting for server to be ready...")
|
|
for i in range(10):
|
|
try:
|
|
requests.get("http://127.0.0.1:5002/health") # Assuming health check or just root
|
|
break
|
|
except:
|
|
time.sleep(2)
|
|
|
|
print("Invoking Summarize API...")
|
|
try:
|
|
# Use a longer timeout for the genai processing
|
|
r = requests.get("http://127.0.0.1:5002/api/summarize?v=qZvqydUEzqA&title=Disturbed%20-%20The%20Sound%20Of%20Silence&lang=vi", timeout=60)
|
|
print(f"Status Code: {r.status_code}")
|
|
print("Response Body Snippet:")
|
|
print(r.text[:500])
|
|
except Exception as e:
|
|
print(f"Request Failed: {e}")
|