import requests BASE = "http://127.0.0.1:8000" # -------- Chat Test -------- chat_payload = {"message": "Hi Jarvis, how are you?"} chat_res = requests.post(f"{BASE}/chat", json=chat_payload) print("Chat reply:", chat_res.json().get("reply")) # -------- Summarize Test -------- summarize_payload = {"text": "FastAPI is a modern, fast web framework for building APIs with Python. It is easy to use and very efficient for creating APIs quickly."} summarize_res = requests.post(f"{BASE}/summarize", json=summarize_payload) print("Summary:", summarize_res.json().get("summary")) # -------- Translate Test -------- translate_payload = {"text": "How are you?", "direction": "en-hi"} # English -> Hindi translate_res = requests.post(f"{BASE}/translate", json=translate_payload) print("Translation:", translate_res.json().get("translation")) # -------- Sentiment Test -------- sentiment_payload = {"text": "I love building AI projects!"} sentiment_res = requests.post(f"{BASE}/sentiment", json=sentiment_payload) print("Sentiment:", sentiment_res.json())