# The Gradio API is not working

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fthe-gradio-api-is-not-working%2F166407%3E%5C
**Category:** Beginners\
**Created:** [August 11, 2025, 1:02pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fthe-gradio-api-is-not-working%2F166407 "2025-08-11T13:02:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![GoldDany](https://avatars.discourse-cdn.com/v4/letter/g/bbce88/32.png) [@GoldDany](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FGoldDany)%5C
**Post date:** [August 11, 2025, 1:02pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fthe-gradio-api-is-not-working%2F166407%2F1 "2025-08-11T13:02:57Z")

</div>

the gradio throws error: Traceback (most recent call last):  
File “C:\Users\danya\PycharmProjects\DiDefBackend\DiDef\SentenceTransformer.py”, line 45, in  
client = Client(  
File “C:\Users\danya\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\_client\client.py”, line 171, in **init**  
self.\_info = self.\_get\_api\_info()  
File “C:\Users\danya\AppData\Local\Programs\Python\Python39\lib\site-packages\gradio\_client\client.py”, line 564, in _get\_api\_info  
info = r.json()  
File “C:\Users\danya\AppData\Local\Programs\Python\Python39\lib\site-packages\httpx\_models.py”, line 764, in json  
return jsonlib.loads(self.content, \*\*kwargs)  
File "C:\Users\danya\AppData\Local\Programs\Python\Python39\lib\json\_init_.py", line 346, in loads  
return \_default\_decoder.decode(s)  
File “C:\Users\danya\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”, line 337, in decode  
obj, end = self.raw\_decode(s, idx=\_w(s, 0).end())  
File “C:\Users\danya\AppData\Local\Programs\Python\Python39\lib\json\decoder.py”, line 355, in raw\_decode  
raise JSONDecodeError(“Expecting value”, s, err.value) from None  
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

why? My code is very simple:

from gradio\_client import Client

client = Client(  
src = “GoldDany/DiDefBackend”, #my Space is public  
)  
result = client.predict(  
text=“Hello!!”,  
api\_name=“/predict”,  
)  
print(result)

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [August 11, 2025, 1:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fthe-gradio-api-is-not-working%2F166407%2F2 "2025-08-11T13:53:44Z")

</div>

> Python39

I think this is probably the culprit this time.

[Gradio 5 only works with Python `3.10` or later](https://github.com/gradio-app/gradio/issues/9634) on both the server and client, so I think the error is occurring because the versions are different between the client and server.  
I don’t know if this error can be potentially resolved…

The simplest solution is to use Python `3.10` or later.😅

```py
# pip install -U gradio_client (in Python 3.9 environment)
import subprocess
subprocess.run("pip show gradio_client", shell=True) # Version: 1.3.0 (Release date: 2024.08.08)
from gradio_client import Client

client = Client(src="John6666/apitest1") # Gradio 4.41.0
result = client.predict(text="Hello!!", api_name="/predict")
print(result) # [0.010964062064886093, 0.02713009901344776, -0.024556249380111694, 0.01713254489004612, 0.04088324308395386, -0.005583592690527439, 0.015990763902664185,...

client = Client(src="GoldDany/DiDefBackend") # Gradio 5.42.0
result = client.predict(text="Hello!!", api_name="/predict")
print(result) # error

```

---

<div class="post-metadata">

**Author:** ![GoldDany](https://avatars.discourse-cdn.com/v4/letter/g/bbce88/32.png) [@GoldDany](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FGoldDany)%5C
**Post date:** [August 11, 2025, 2:24pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fthe-gradio-api-is-not-working%2F166407%2F3 "2025-08-11T14:24:40Z")

</div>

Thanks) But I may have to use an even lower version python, because integrating it ☠ . But downgrading the version of Gradio works))

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/hellohellohello/original/2X/d/de4155eb4aa4108ecb32a1389d7cc37ae69f88b7.png) [@system](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsystem)%5C
**Post date:** [August 12, 2025, 2:25am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fthe-gradio-api-is-not-working%2F166407%2F4 "2025-08-12T02:25:10Z")

</div>

Closed on August 12, 2025, 2:25am UTC

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.
