Spaces:
Runtime error
Runtime error
File size: 917 Bytes
a892c2b |
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 36 37 |
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() |