Download repochat/git.py from rcs3/Codebot: direct link, hf CLI and curl.
- Browser
- Download file 1.19 kB
-
https://huggingface.co/spaces/rcs3/Codebot/resolve/f1e02160b277deb7ba50ee4eef6cfab2ed3233c2/repochat/git.py
- Command line
-
hf download hf://spaces/rcs3/Codebot@f1e02160b277deb7ba50ee4eef6cfab2ed3233c2/repochat/git.py
-
curl -L -o git.py https://huggingface.co/spaces/rcs3/Codebot/resolve/f1e02160b277deb7ba50ee4eef6cfab2ed3233c2/repochat/git.py
1.19 kB
| import requests | |
| import streamlit as st | |
| from .utils import url_name, clone_repo | |
| def git_form(repo_path): | |
| with st.sidebar: | |
| st.title("GitHub Link") | |
| with st.form("git"): | |
| git_url = st.text_input("Enter GitHub Repository Link") | |
| submit_git = st.form_submit_button("Submit") | |
| if submit_git: | |
| with st.spinner("Checking GitHub URL"): | |
| if not(git_url): | |
| st.warning("Enter GitHub URL") | |
| st.stop() | |
| try: | |
| response = requests.get(git_url) | |
| if response.status_code == 200 and url_name(git_url): | |
| st.success("GitHub Link loaded successfully!") | |
| db_name = url_name(git_url) | |
| else: | |
| st.error("Enter Valid GitHub Repo") | |
| st.stop() | |
| except requests.exceptions.MissingSchema: | |
| st.error("Invalid URL. Please include the scheme (e.g., https://)") | |
| st.stop() | |
| with st.spinner(f"Cloning {db_name} Repository"): | |
| clone_repo(git_url, repo_path) | |
| st.success("Cloned successfully!") | |
| return db_name, 1 |