Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: PHP Fatal error: Server sent invalid upgrade response: HTTP/1.1 403 Forbidden #8

Open
AngelTs opened this issue Nov 21, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@AngelTs
Copy link

AngelTs commented Nov 21, 2023

What happened?

PHP Fatal error: Uncaught WebSocket\ConnectionException: Connection to 'wss://9797a8c499d50575a3.gradio.live/queue/join' failed: Server sent invalid upgrade response: HTTP/1.1 403 Forbidden

How to reproduce the bug

<?php
require __DIR__ . '/vendor/autoload.php';
use SergiX44\Gradio\Client;
$client = new Client('https://aefe63bef807636ece.gradio.live/');
$result = $client->predict(["Hello!!"], apiName: '/predict');
echo $result;
?>

I have one prompt for text (as input) and expected to generate one picture (as output)

Use via Python client API:

from gradio_client import Client
client = Client("https://aefe63bef807636ece.gradio.live/")
result = client.predict(
		"Hello!!",	# str  in 'prompt' Textbox component
							api_name="/predict"
)
print(result)

Use via Javascript client API:

import { client } from "@gradio/client";
const app = await client("https://aefe63bef807636ece.gradio.live/");
const result = await app.predict("/predict", [		
				"Hello!!", // string  in 'prompt' Textbox component
	]);
console.log(result.data);

Package Version

2.0.0

PHP Version

8.2.0

Which operating systems does with happen with?

Linux

Notes

No response

@AngelTs AngelTs added the bug Something isn't working label Nov 21, 2023
@AngelTs
Copy link
Author

AngelTs commented Nov 22, 2023

The strange thing is if use "Hello world" common well space, the PHP API works fine and correct, but if use the same php api in my server, the f..g error occures: HTTP/1.1 403 Forbidden

@AngelTs
Copy link
Author

AngelTs commented Nov 23, 2023

After one day of unsuccessful tests, maybe i found the reason for the error "wss:...Server sent invalid upgrade response: HTTP/1.1 403 Forbidden" with probability of 70-80% to be true:
This API do not work with servers like "https://XXXXXXXXXXXXXXXXXX.gradio.live/" and "https://XXXXXXXXXXXXXXXXXX.gradio.live/queue/join".
Only works with HF spaces servers like "https://XXXXXXX.hf.space/api/predict", "https://XXXXXXX.hf.space", "https://huggingface.co/spaces/XXXXXXXXX", etc.

@AngelTs
Copy link
Author

AngelTs commented Dec 13, 2023

Twice confirmed that this library do NOT works with "https://xxxxxxxxxxxxxxxxxx.gradio.live/" servers!!!

This shold be notified (on visible place) to save limited time and effords in this hot AI area at the moment!

"PHP Fatal error: Uncaught WebSocket\ConnectionException: Connection to 'wss://5585d147a4282f6f30.gradio.live/queue/join' failed: Server sent invalid upgrade response: HTTP/1.1 403 Forbidden"

1.Confirmed via shared hosting on Linux
2.Confirmed via local PC with no server Windows 10 with installed php 8.3.0, but not installed any web server!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant