File size: 790 Bytes
7ea3034
7495eb5
7ea3034
 
7495eb5
7ea3034
 
7495eb5
d5d6495
7ea3034
 
 
 
 
 
 
 
d5d6495
 
7ea3034
 
d5d6495
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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)