i was trying to test the api of this but its not working

#4
by shaktibiplab - opened

(base) ┌──(shakti㉿aeroverse)-[~/Projects/ai/another try]
└─$ python predict.py
Loaded as API: https://nveagle-eagle-x5-13b-chat.hf.space
Traceback (most recent call last):
File "/mnt/storage/Projects/ai/another try/predict.py", line 30, in
main()
File "/mnt/storage/Projects/ai/another try/predict.py", line 14, in main
result = client.predict(
^^^^^^^^^^^^^^^
File "/home/shakti/anaconda3/lib/python3.12/site-packages/gradio_client/client.py", line 468, in predict
).result()
^^^^^^^^
File "/home/shakti/anaconda3/lib/python3.12/site-packages/gradio_client/client.py", line 1499, in result
return super().result(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/shakti/anaconda3/lib/python3.12/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/home/shakti/anaconda3/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/home/shakti/anaconda3/lib/python3.12/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/shakti/anaconda3/lib/python3.12/site-packages/gradio_client/client.py", line 1121, in _inner
predictions = _predict(*data)
^^^^^^^^^^^^^^^
File "/home/shakti/anaconda3/lib/python3.12/site-packages/gradio_client/client.py", line 1233, in _predict
raise AppError(
gradio_client.exceptions.AppError: The upstream Gradio app has raised an exception but has not enabled verbose error reporting. To enable, set show_error=True in launch().

from gradio_client import Client, handle_file

def main():
# Initialize the Gradio client with the specified API
client = Client("NVEagle/Eagle-X5-13B-Chat")

# URL or local path to the image file you want to test
image_url = 'image_8.webp'

# Text prompt to be used with the image
prompt = "Hello!!"

try:
    # Predict function call to generate a result based on the image and text input
    result = client.predict(
        imagebox=handle_file(image_url),  # Provide image URL or local path
        textbox=prompt,  # Text input for the Textbox component
        image_process_mode="Default",  # Image processing mode
        temperature=0.2,  # Temperature for text generation
        top_p=0.7,  # Top P value for text generation
        max_output_tokens=512,  # Maximum output tokens
        api_name="/generate_2"  # API endpoint
    )
    
    # Print the result
    print("Chatbot Output:", result[0])
    print("Textbox Output:", result[1])
    print("Output Image Path:", result[2])

except Exception as e:
    # Print the exception details
    print("An error occurred:", e)

if name == "main":
main()

its the test file - predict.py

Sign up or log in to comment