Error on Gradio Huggingface Spaces API

#20
by amooo-ooo - opened

Problem

It seems like there is an error with the implementation of the Gradio Huggingface Spaces API. Running the default code snippet, and replacing the placeholder values with basic input data results in an error.

Code

from gradio_client import Client

client = Client("cagliostrolab/animagine-xl-3.1")
result = client.predict(
        "frieren",	# str  in 'Prompt' Textbox component
        "",	# str  in 'Negative Prompt' Textbox component
        0,	# float (numeric value between 0 and 2147483647) in 'Seed' Slider component
        512,	# float (numeric value between 512 and 2048) in 'Width' Slider component
        512,	# float (numeric value between 512 and 2048) in 'Height' Slider component
        1,	# float (numeric value between 1 and 12) in 'Guidance scale' Slider component
        1,	# float (numeric value between 1 and 50) in 'Number of inference steps' Slider component
        "DPM++ 2M Karras",	# Literal['DPM++ 2M Karras', 'DPM++ SDE Karras', 'DPM++ 2M SDE Karras', 'Euler', 'Euler a', 'DDIM']  in 'Sampler' Dropdown component
        "1024 x 1024",	# Literal['1024 x 1024', '1152 x 896', '896 x 1152', '1216 x 832', '832 x 1216', '1344 x 768', '768 x 1344', '1536 x 640', '640 x 1536', 'Custom']  in 'Aspect Ratio' Radio component
        "(None)",	# Literal['(None)', 'Cinematic', 'Photographic', 'Anime', 'Manga', 'Digital Art', 'Pixel art', 'Fantasy art', 'Neonpunk', '3D Model']  in 'Style Preset' Radio component
        "(None)",	# Literal['(None)', 'Standard v3.0', 'Standard v3.1', 'Light v3.1', 'Heavy v3.1']  in 'Quality Tags Presets' Dropdown component
        True,	# bool  in 'Use Upscaler' Checkbox component
        0,	# float (numeric value between 0 and 1) in 'Strength' Slider component
        1,	# float (numeric value between 1 and 1.5) in 'Upscale by' Slider component
        True,	# bool  in 'Add Quality Tags' Checkbox component
        api_name="/run"
)
print(result)

Terminal Output

PS C:\Users\User\Documents\GitHub\animegen> py test.py
Loaded as API: https://cagliostrolab-animagine-xl-3-1.hf.space ✔
Traceback (most recent call last):
  File "C:\Users\User\Documents\GitHub\animegen\test.py", line 4, in <module>
    result = client.predict(
             ^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio_client\client.py", line 463, in predict
    ).result()
      ^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio_client\client.py", line 1485, in result
    return super().result(timeout=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio_client\client.py", line 1112, in _inner
    predictions = _predict(*data)
                  ^^^^^^^^^^^^^^^
  File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\gradio_client\client.py", line 1223, 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().

try writing "False" to the upscaler parameter.

Omg that works! Thanks, that's so cool! :D

amooo-ooo changed discussion status to closed

Sign up or log in to comment