Skip to content

Gradio Client package for NodeJS not connecting to HF Space, but Python one works normally. #8213

Closed
@mahiatlinux

Description

Describe the bug

Hey guys.
The Gradio Client package for NodeJS doesn't seem to be working correctly. It does not connect to the Space.

NodeJS:

import { client } from "@gradio/client";

const app = await client("mahiatlinux/MasherAI-v6-7B-Chat");
const result = await app.predict("/chat", [        
                "Hello!!", // string  in 'Message' Textbox component        
                "Hello!!", // string  in 'System prompt' Textbox component        
                1, // number (numeric value between 1 and 2048) in 'Max new tokens' Slider component        
                0.1, // number (numeric value between 0.1 and 4.0) in 'Temperature' Slider component        
                0.05, // number (numeric value between 0.05 and 1.0) in 'Top-p (nucleus sampling)' Slider component        
                1, // number (numeric value between 1 and 1000) in 'Top-k' Slider component        
                1, // number (numeric value between 1.0 and 2.0) in 'Repetition penalty' Slider component
    ]);

console.log(result.data);

Output:

maheswar@linuxboi4:~$ node app.mjs
Cannot connect to SSE endpoint: https://mahiatlinux-masherai-v6-7b-chat.hf.space/queue/data?session_hash=zcpzs1ec9kk

The Python one works normally and connects to the Space.
For eg Python:

from gradio_client import Client

client = Client("mahiatlinux/MasherAI-v6-7B-Chat")
result = client.predict(
    "Hello!!",  # str in 'Message' Textbox component
    "Hello!!",  # str in 'System prompt' Textbox component
    200,  # float (numeric value between 1 and 2048) in 'Max new tokens' Slider component
    0.7,  # float (numeric value between 0.1 and 4.0) in 'Temperature' Slider component
    0.05,  # float (numeric value between 0.05 and 1.0) in 'Top-p (nucleus sampling)' Slider component
    1,  # float (numeric value between 1 and 1000) in 'Top-k' Slider component
    1,  # float (numeric value between 1.0 and 2.0) in 'Repetition penalty' Slider component
    api_name="/chat"
)
print(result)

Output:

maheswar@linuxboi4:~$ python3 app.py
Loaded as API: https://mahiatlinux-masherai-v6-7b-chat.hf.space ✔
Hey there! How can I make your day better?

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import { client } from "@gradio/client";

const app = await client("mahiatlinux/MasherAI-v6-7B-Chat");
const result = await app.predict("/chat", [        
                "Hello!!", // string  in 'Message' Textbox component        
                "Hello!!", // string  in 'System prompt' Textbox component        
                1, // number (numeric value between 1 and 2048) in 'Max new tokens' Slider component        
                0.1, // number (numeric value between 0.1 and 4.0) in 'Temperature' Slider component        
                0.05, // number (numeric value between 0.05 and 1.0) in 'Top-p (nucleus sampling)' Slider component        
                1, // number (numeric value between 1 and 1000) in 'Top-k' Slider component        
                1, // number (numeric value between 1.0 and 2.0) in 'Repetition penalty' Slider component
    ]);

console.log(result.data);

Screenshot

No response

Logs

No response

System Info

maheswar@linuxboi4:~$ gradio environment
Gradio Environment Information:
------------------------------
Operating System: Linux
gradio version: 4.21.0
gradio_client version: 0.12.0

------------------------------------------------
gradio dependencies in your environment:

aiofiles: 23.2.1
altair: 5.2.0
fastapi: 0.109.2
ffmpy: 0.3.2
gradio-client==0.12.0 is not installed.
httpx: 0.27.0
huggingface-hub: 0.20.3
importlib-resources: 6.3.0
jinja2: 3.1.3
markupsafe: 2.1.5
matplotlib: 3.5.1
numpy: 1.26.4
orjson: 3.10.3
packaging: 23.2
pandas: 2.2.0
pillow: 9.0.1
pydantic: 2.6.0
pydub: 0.25.1
python-multipart: 0.0.9
pyyaml: 5.4.1
ruff: 0.3.2
semantic-version: 2.10.0
tomlkit==0.12.0 is not installed.
typer: 0.9.0
typing-extensions: 4.11.0
uvicorn: 0.27.1
authlib; extra == 'oauth' is not installed.
itsdangerous; extra == 'oauth' is not installed.


gradio_client dependencies in your environment:

fsspec: 2023.10.0
httpx: 0.27.0
huggingface-hub: 0.20.3
packaging: 23.2
typing-extensions: 4.11.0
websockets: 11.0.3

Severity

Blocking usage of gradio

Metadata

Assignees

Labels

bugSomething isn't workinggradio_clientRelated to the one of the gradio client libraries

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions