Spaces:
Running
Running
import requests | |
# Replace with the correct Space API URL | |
api_url = "https://hf.space/embed/Canstralian/WhiteRabbitNeo/api/predict/" | |
# The input payload to send to the model | |
payload = {"data": ["A new bug bounty to solve"]} | |
try: | |
# Make a POST request to the API | |
response = requests.post(api_url, json=payload) | |
response.raise_for_status() # Raise an exception for HTTP errors | |
# Parse the result | |
result = response.json() # Parse the JSON response from the API | |
print("Generated Result:", result["data"][0]) # Access the generated result | |
# Optionally, save the result to a text file | |
with open("generated_output.txt", "w") as f: | |
f.write(result["data"][0]) | |
except requests.exceptions.RequestException as e: | |
print("An error occurred:", e) |