HNTAI / services /ai-service /verify_generic_gen.py
sachinchandrankallar's picture
changes for publishing the latest including generate_generic api
4156c57
Raw
History Blame
997 Bytes
import requests
import time
import json
def verify_generic_gen():
url = "http://localhost:7860/generate_generic"
payload = {
"text": "The patient complains of severe headache and nausea.",
"custom_prompt": "List the symptoms mentioned in the text.",
"model_name": "microsoft/Phi-3-mini-4k-instruct-gguf/Phi-3-mini-4k-instruct-q4.gguf",
"model_type": "gguf"
}
print(f" sending request to {url} with payload: {json.dumps(payload, indent=2)}")
try:
response = requests.post(url, json=payload, timeout=300)
print(f"Status Code: {response.status_code}")
if response.status_code == 200:
print("Response:", json.dumps(response.json(), indent=2))
else:
print("Error Response:", response.text)
except Exception as e:
print(f"Request failed: {e}")
if __name__ == "__main__":
# Wait for server to potentially start
time.sleep(5)
verify_generic_gen()