Spaces:
Runtime error
Runtime error
import requests | |
# Replace with your actual Space URL | |
API_URL = "https://sidharthan-scriptr.hf.space/generate" | |
def test_single_request(): | |
# Test data | |
test_prompt = """ | |
<bos><start_of_turn>user | |
how are you? | |
<start_of_turn>model | |
""" | |
# Make request | |
try: | |
response = requests.post( | |
API_URL, | |
json={ | |
"message": test_prompt, | |
"temperature": 0.7, | |
"max_length": 512 | |
} | |
) | |
# Print results | |
print(f"Status Code: {response.status_code}") | |
if response.status_code == 200: | |
print("\nGenerated Text:") | |
print(response.json()['generated_text']) | |
else: | |
print(f"Error: {response.text}") | |
except Exception as e: | |
print(f"Error making request: {str(e)}") | |
if __name__ == "__main__": | |
test_single_request() |