Embedding Spaces with auth for public models counter-intuitive?
I think I must be missing something. Can someone tell me what?Embedding spaces is a great option - but only available for public spacesThe gradio instructions even show how to add authentication - awesome!But as your space is now public (because 1), you have to remember to add your auth credentials in a secret, otherwise anyone can just see it in your codeAlso, you have to make your space public to use the Embed option, while you may not have been ready to do soMy take: One of the clear use cases to use “Embed your space” is to share the app without sharing the code (e.g. prototype for something that is in stealth), but by only allowing the option for public spaces, that use case won’t fly.Am I missing something? Is there a better way to do this?
2023-03-07T05:46:23Z
For anyone else reading this: I couldn’t find a good solution this for my situation, so I ended up running my Gradio application on one of the well known PaaS providers. Works quite well with github integration, just had to set a few environment settings.I do want to stress that I’m still a huge fan of Huggingface, and it may not make sense for the platform to support the “stealth” scenario I describe above.
2023-03-09T08:24:24Z
Hello@EtheE, thank you for your feedback. We have received similar requests in the past, we might implement a solution it in the future. However, we have previously suggested different workarounds depending on the specific use case:To hide sensitive source code on Space, you can create a private Space and a second public Space which only loads the private Space using the ‘gr.Interface.load()’ method. This method can load a Space even if it is private. Check more herGradio Docs.To hide specific files only, you can create a private dataset/model and use the ‘huggingface_hub’ client to load your dataset/model using the hub token via Space settings.You can also use our Inference Endpoints PaaS service which is fully integrated with HF tools and our hub. This service provides a way to deploy a Space as a REST API. You can learn more about it hereInference Endpoints - Hugging Face
2023-03-12T05:57:54Z
Thanks@radames! Even though I searched, I hadn’t come across that first answer! While it introduces a bit of overhead, it’s definitely a good option and something I’ll give another try in the near future.
2023-03-12T06:17:48Z
Thanks for the feedback, I’ll update our Space docs
2023-04-19T15:21:47Z
Hello@radames, thank you for the suggestions. I just tried the first option (load Space from a private Space), but the app throws this error if the source code Space is private:File "/home/user/.local/lib/python3.8/site-packages/websockets/legacy/client.py", line 329, in handshake
    raise InvalidStatusCode(status_code, response_headers)
websockets.exceptions.InvalidStatusCode: server rejected WebSocket connection: HTTP 404Maybe something change lately within Spaces?I´m using Gradio Blocks instead of directly use gr.load(), according to their documentation. Would this cause the problem?
2023-04-25T14:25:18Z
However, using ‘gr.load()’ method need user_token, which will be public in the second space.
2023-04-25T17:49:55Z
hi@germanp, can you please make sure you’re on the latest Gradio version?, checking on the metadata on README.mdsdk: gradio
sdk_version: 3.27.0
2023-04-25T17:54:25Z
you can use the Spaces secrets to share your user_token, that will be on the server side on your Gradio app,Spaces Overview
2023-04-26T03:24:03Z
Thank you for your response! I just tried it and it worked, but the output is empty while the referenced space works well. It takes the same amount of time as the referenced space, so I think it should have actually run, but there was no expected output.My take: I use ‘gr.load().launch()’, my space’s input is a image and output is a video.
2023-04-26T04:43:07Z
another alternative is to try our new gradio client library, it also supports loading from a private Spacegradio.appGetting Started With The Python ClientA Step-by-Step Gradio Tutorial
2023-04-26T08:10:55Z
I guess that the video is stored in the referenced space, the output component use the path of the video, when it comes to the second space, it can’t find the video path in his own space, so the output is empty.
2023-04-26T11:17:45Z
I solved my problem perfectly with this solution. Thank you very much
2023-04-26T16:59:09Z
very cool@o0o0o00o0, cc@freddyaboultonsince Gradio client solved the issue
2023-05-11T06:39:08Z
@o0o0o00o0@radamesI tried this the gradio_client solution to call a private HF space of mine, but the API link I got (in the format of xxx-yyy.hf.space) is not sharable and can only be used by me. Is there a way make it sharable to others?Using the gr.load() method I got into the same issue as@o0o0o00o0, where the output images are empty.
2023-05-11T06:59:28Z
Have you make the space which uses the gradio_client solution public?
2023-05-11T14:33:32Z
Hi there, I get the following error when I try launching a public space.for fn_index, dependency in enumerate(self.config["dependencies"])KeyError: ‘dependencies’Would you know why this is happening?
2023-05-11T17:10:58Z
Thanks for responding@o0o0o00o0. I have made it public.Just in case I misunderstood the instruction, here’s my code for the new HF space, which should take image inputs from users and output images:import os
from gradio_client import Client
HF_token = os.environ.get('HF_token')
client = Client('xxx/yyy', REDACTED_TOKEN=HF_token )The new space actually resulted in a runtime error:Loaded as API: https://xxx-yyy.hf.spaceand this API above is what I was referring to as not sharable.
2023-06-02T03:42:26Z
Hi there, did you solve this?I also got this error but don’t know what happened.
2023-06-23T18:29:21Z
I am also getting the same error. Not able to load private space from public space with HF token
No date available
No reply text available