cannot use api

#2
by nebulae7 - opened

I run this cmd
from gradio_client import Client

client = Client("https://tiiuae-falcon-chat.hf.space/")
result = client.predict("Howdy!",fn_index=0)
print(result)

getting error like this
Loaded as API: https://tiiuae-falcon-chat.hf.space/
Traceback (most recent call last):
File "C:\Python311\Lib\site-packages\gradio_client\client.py", line 683, in _predict
output = result["data"]
~~~~~~^^^^^^^^
KeyError: 'data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\Users\pawan\OneDrive\Desktop\max\main.py", line 12, in
result = client.predict(
^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\gradio_client\client.py", line 285, in predict
return self.submit(*args, api_name=api_name, fn_index=fn_index).result()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\gradio_client\client.py", line 990, in result
return super().result(timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\concurrent\futures_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\concurrent\futures_base.py", line 401, in __get_result
raise self._exception
File "C:\Python311\Lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\gradio_client\client.py", line 645, in _inner
predictions = _predict(*data)
^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\gradio_client\client.py", line 689, in _predict
if "error" in result and "429" in result["error"] and is_public_space:
^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: argument of type 'NoneType' is not iterable

please help

Same me too

Is there a Rest API for the 'Falcon-40b' LLM?

This code should fix your problems:

from gradio_client import Client

client = Client("tiiuae/falcon-180b-demo")
result = client.predict("Howdy!", "You are a helpful assistant", 0.9, 256, 0.9, 1.2)
print(result)

Here are the parameters for the predict function:

predict(message, optional_system_prompt, temperature, max_new_tokens, topp_nucleus_sampling, repetition_penalty)

Sign up or log in to comment