# Share app url without sharing the files and version

**URL:** <https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182>\
**Category:** Spaces\
**Created:** [November 16, 2022, 5:16pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182 "2022-11-16T17:16:14Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kunal7](https://avatars.discourse-cdn.com/v4/letter/k/f6c823/32.png) [@Kunal7](https://discuss.huggingface.co/u/Kunal7)\
**Post date:** [November 16, 2022, 5:16pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/1 "2022-11-16T17:16:14Z")

</div>

Hi Community!

I just want to share the URL of my application without sharing the **Files and versions** on Huggingface spaces. Is there any way to achieve this?

---

<div class="post-metadata">

**Author:** ![freddyaboulton](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/freddyaboulton/32/32732_2.png) [@freddyaboulton](https://discuss.huggingface.co/u/freddyaboulton)\
**Post date:** [November 17, 2022, 10:49pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/2 "2022-11-17T22:49:29Z")

</div>

Hi @Kunal7 !

Is this for gradio or streamlit? To be clear, you’d like to share your space without people being able to read it’s source code?

---

<div class="post-metadata">

**Author:** ![anon15932797](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@anon15932797](https://discuss.huggingface.co/u/anon15932797)\
**Post date:** [November 18, 2022, 4:07am UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/3 "2022-11-18T04:07:12Z")

</div>

I’ve a streamlit app that I’d like to host on huggingface spaces without people being able to read the source code. Is it possible to do so?

---

<div class="post-metadata">

**Author:** ![Kunal7](https://avatars.discourse-cdn.com/v4/letter/k/f6c823/32.png) [@Kunal7](https://discuss.huggingface.co/u/Kunal7)\
**Post date:** [November 18, 2022, 7:35am UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/4 "2022-11-18T07:35:02Z")

</div>

Hi @freddyaboulton!

Thanks for the response. I am trying to deploy my app on streamlit.

> To be clear, you’d like to share your space without people being able to read its source code?

Yes, exactly. This is what I intend to do

---

<div class="post-metadata">

**Author:** ![freddyaboulton](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/freddyaboulton/32/32732_2.png) [@freddyaboulton](https://discuss.huggingface.co/u/freddyaboulton)\
**Post date:** [November 18, 2022, 6:27pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/5 "2022-11-18T18:27:44Z")

</div>

Thanks for the clarification @Kunal7 and @anon15932797 ! There isn’t a built in solution for this at the moment. Will bring this up with the team!

---

<div class="post-metadata">

**Author:** ![freddyaboulton](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/freddyaboulton/32/32732_2.png) [@freddyaboulton](https://discuss.huggingface.co/u/freddyaboulton)\
**Post date:** [November 18, 2022, 7:45pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/6 "2022-11-18T19:45:30Z")

</div>

@Kunal7 and @anon15932797 one thing you could do is clone a private repo from your app.py file and import your demo from there. I’ve seen that with gradio demos it might work with streamlit!

Can you please explain your use case a bit more? How come you’d like to keep the code private?

---

<div class="post-metadata">

**Author:** ![ugursahin](https://avatars.discourse-cdn.com/v4/letter/u/ecb155/32.png) [@ugursahin](https://discuss.huggingface.co/u/ugursahin)\
**Post date:** [November 20, 2022, 7:39pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/7 "2022-11-20T19:39:29Z")

</div>

That is actually a great idea, one can use that with fine-granular personal access token(PAT).

Create a PAT from GitHub with Content read access and use it as a password.

Basically, the link will become  
`https://YOUR_USERNAME:YOUR_PAT_TOKEN@github.com/YOUR_USERNAME/YOUR_REPOSITORY_NAME.git`

It is not possible to use ssh _(port 22)_ because only ports 80 and 443 are allowed.

Then, by using the **`gitpython`** library, the repository can be downloaded from the inside of the python script

Another way would be using SSH over HTTPS, I tried and learned a lot about underlying containers, I would be happy if anyone would like to try that. 🙂

---

<div class="post-metadata">

**Author:** ![anon15932797](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@anon15932797](https://discuss.huggingface.co/u/anon15932797)\
**Post date:** [November 24, 2022, 3:34pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/8 "2022-11-24T15:34:33Z")

</div>

I’ve created a PAT from Github with content read access and followed the other instructions. However I couldn’t figure out how to use gitpython, could you elaborate on this? I’ve tried `git.Repo.clone_from()` function and also tried using `pygit2` package.

---

<div class="post-metadata">

**Author:** ![ugursahin](https://avatars.discourse-cdn.com/v4/letter/u/ecb155/32.png) [@ugursahin](https://discuss.huggingface.co/u/ugursahin)\
**Post date:** [November 24, 2022, 6:17pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/9 "2022-11-24T18:17:29Z")

</div>

After installing gitpython, you can import it:

```auto
from git import Repo

```

And using clone\_from()

```auto
Repo.clone_from("https://YOUR_USERNAME:YOUR_PAT_TOKEN@github.com/YOUR_USERNAME/YOUR_REPOSITORY_NAME.git", 
    "/repo_directory")

```

I assume you know putting your PAT Token to secrets and calling it from environment variables. Otherwise someone can read your private repository. The following document structure is expected:

```auto
your_huggingface_repo/
  app.py
  README.py
  repo_directory/
    inside_code.py

```

After downloading the repo:

```auto
import repo_directory.inside_code as inside_code

```

should be the last step.

---

<div class="post-metadata">

**Author:** ![anon15932797](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@anon15932797](https://discuss.huggingface.co/u/anon15932797)\
**Post date:** [November 25, 2022, 5:51am UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/10 "2022-11-25T05:51:25Z")

</div>

I’ve followed these steps and it works with default values, but whenever I make a different selection from drop-down it’s throwing an error

`GitCommandError: Cmd('git') failed due to: exit code(128) cmdline: git clone -v https:// *****:***** @github.com/TracingInsights/Charts.git repo_directory stderr: 'fatal: destination path 'repo_directory' already exists and is not an empty directory. '`

My huggingface space is at: [F1 Analysis - a Hugging Face Space by tracinginsights](https://huggingface.co/spaces/tracinginsights/F1-analysis)  
My streamlit app is at: [https://tracinginsights.streamlit.app/](https://tracinginsights.streamlit.app/)

---

<div class="post-metadata">

**Author:** ![BobvanVeen](https://avatars.discourse-cdn.com/v4/letter/b/d78d45/32.png) [@BobvanVeen](https://discuss.huggingface.co/u/BobvanVeen)\
**Post date:** [March 29, 2023, 1:02pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/11 "2023-03-29T13:02:03Z")

</div>

Hi there, currently I’m in a position where I need to hide my code but I do wan’t to share the streamlit app. Did you manage to get it working, and if yes, how did you solve this last drop-down error?

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [March 29, 2023, 6:57pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/12 "2023-03-29T18:57:34Z")

</div>

hi @BobvanVeen , I’ve recently responded to same same question here, please let me know if that helps you, otherwise I’m happy to help

> [@Embedding Spaces with auth for public models counter-intuitive?](https://discuss.huggingface.co/t/embedding-spaces-with-auth-for-public-models-counter-intuitive/32868/3):
>
> 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 her [Gradio Docs](https://gradio.app/docs/#interface-load). To hide …

---

<div class="post-metadata">

**Author:** ![kartikay24](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/kartikay24/32/15534_2.png) [@kartikay24](https://discuss.huggingface.co/u/kartikay24)\
**Post date:** [April 20, 2023, 1:10pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/13 "2023-04-20T13:10:23Z")

</div>

Hi everyone! I’ve got a gradio app hosted on HuggingFace Spaces that I’m using to collect data from different users on HuggingFace Datasets. However, I don’t want to expose the code to the users. How can I achieve that?

---

<div class="post-metadata">

**Author:** ![aannor](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@aannor](https://discuss.huggingface.co/u/aannor)\
**Post date:** [August 30, 2023, 10:40pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/14 "2023-08-30T22:40:44Z")

</div>

Hi @radames I’ve tried using gr.load() to load my sreamlit app from a private space but I get ValueError: Could not load the Space. Is there a workaround for streamlit apps?

---

<div class="post-metadata">

**Author:** ![radames](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/radames/32/28246_2.png) [@radames](https://discuss.huggingface.co/u/radames)\
**Post date:** [August 30, 2023, 11:15pm UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/15 "2023-08-30T23:15:25Z")

</div>

Hi @aannor, unfortunately, all these tricks only work for Gradio apps as `gr.load()` is an exclusive design considering Spaces infra. I’m not familiar with any tricks to overcome this with Streamlit. Perhaps @whitphx knows of a trick?

---

<div class="post-metadata">

**Author:** ![whitphx](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/whitphx/32/22242_2.png) [@whitphx](https://discuss.huggingface.co/u/whitphx)\
**Post date:** [September 22, 2023, 8:25am UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/16 "2023-09-22T08:25:15Z")

</div>

Unfortunately I don’t have any idea on it… ALAIK `gr.load()` only works with Gradio Spaces (and Model repos).

---

<div class="post-metadata">

**Author:** ![educrpg](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/educrpg/32/55607_2.png) [@educrpg](https://discuss.huggingface.co/u/educrpg)\
**Post date:** [December 28, 2023, 6:40am UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/17 "2023-12-28T06:40:04Z")

</div>

Just don’t recreate the directory if it already exists

```auto
if os.path.exists('./repo'):
    pass
else:
    Repo.clone_from(st.secrets['GIT_URL'],'./repo')

```

---

<div class="post-metadata">

**Author:** ![VanessaCrosbyFitzger](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/vanessacrosbyfitzger/32/28335_2.png) [@VanessaCrosbyFitzger](https://discuss.huggingface.co/u/VanessaCrosbyFitzger)\
**Post date:** [June 21, 2024, 1:34am UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/18 "2024-06-21T01:34:47Z")

</div>

Maybe embed? [Embed your Space in another website](https://huggingface.co/docs/hub/en/spaces-embed)

---

<div class="post-metadata">

**Author:** ![dmpantiu](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@dmpantiu](https://discuss.huggingface.co/u/dmpantiu)\
**Post date:** [October 2, 2024, 9:27am UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/19 "2024-10-02T09:27:47Z")

</div>

Hi @freddyaboulton  
No solution yet?

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](https://discuss.huggingface.co/u/John6666)\
**Post date:** [October 2, 2024, 10:02am UTC](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182/20 "2024-10-02T10:02:09Z")

</div>

This is probably the same problem as **the problem of wanting to use a private Space from the outside but passing a token does not help**.  
I think it was only a few months ago, but I couldn’t find a solution then.  
I thought maybe they dared to turn it off to prevent people from just riding on HF’s server resources… but if that’s not the case from HF’s point of view, then there’s a demand for it.

[Next page](https://discuss.huggingface.co/t/share-app-url-without-sharing-the-files-and-version/26182.md?page=2)
