Spaces:
Runtime error
Runtime error
User specified username, repo, and file type selector. Need to deal with access token
Browse files10 unmodified lines1112131415161718192011 unmodified lines3233343536375 unmodified lines4344454647481 unmodified line5051525354555610 unmodified lines#get the GITHUB_ACCESS_TOKEN from the .env fileGITHUB_ACCESS_TOKEN = os.getenv("GITHUB_ACCESS_TOKEN")USER = "heaversm"REPO = "gdrive-docker"GITHUB_BASE_URL = "https://github.com/"FILE_TYPES_TO_LOAD = (".py", ".ts")@st.cache_resourcedef get_hugging_face_model():11 unmodified linesst.title("Find Similar Code")text_input = st.text_area("Enter a Code Example", value ="""def create_app():5 unmodified lines)button = st.button("Find Similar Code")if button:loader = GithubFileLoader(#repo is USER/REPO1 unmodified lineaccess_token=GITHUB_ACCESS_TOKEN,github_api_url="https://api.github.com",file_filter=lambda file_path: file_path.endswith(FILE_TYPES_TO_LOAD))documents = loader.load()10 unmodified lines111213141516171811 unmodified lines303132333435363738394041424344455 unmodified lines51525354555657581 unmodified line6061626364656610 unmodified lines#get the GITHUB_ACCESS_TOKEN from the .env fileGITHUB_ACCESS_TOKEN = os.getenv("GITHUB_ACCESS_TOKEN")GITHUB_BASE_URL = "https://github.com/"@st.cache_resourcedef get_hugging_face_model():11 unmodified linesst.title("Find Similar Code")#streamlit text input for USERUSER = st.text_input("Enter the Github User", value = "heaversm")#streamlit text input for REPOREPO = st.text_input("Enter the Github Repository", value = "gdrive-docker")#streamlit file type selectorFILE_TYPES_TO_LOAD = st.multiselect("Select File Types", [".py", ".ts",".js",".css",".html"], default = [".py"])text_input = st.text_area("Enter a Code Example", value ="""def create_app():5 unmodified lines)button = st.button("Find Similar Code")if button:loader = GithubFileLoader(#repo is USER/REPO1 unmodified lineaccess_token=GITHUB_ACCESS_TOKEN,github_api_url="https://api.github.com",file_filter=lambda file_path: file_path.endswith(tuple(FILE_TYPES_TO_LOAD)))documents = loader.load()
github_st.py+14-4