Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
|
@@ -8,7 +8,7 @@ import json
|
|
| 8 |
import tiktoken
|
| 9 |
|
| 10 |
|
| 11 |
-
# --- Core Helper Functions
|
| 12 |
|
| 13 |
def is_file_type(file_path: str, file_extension: str) -> bool:
|
| 14 |
"""Check if the file has the specified file extension."""
|
|
@@ -65,7 +65,7 @@ def is_test_file(file_content: str, lang: str) -> bool:
|
|
| 65 |
return False
|
| 66 |
|
| 67 |
|
| 68 |
-
# ---
|
| 69 |
def get_token_count(text: str) -> int:
|
| 70 |
"""Calculates the number of tokens in a string using the cl100k_base encoding."""
|
| 71 |
try:
|
|
@@ -77,7 +77,7 @@ def get_token_count(text: str) -> int:
|
|
| 77 |
return 0
|
| 78 |
|
| 79 |
|
| 80 |
-
# --- Core Processing Logic
|
| 81 |
|
| 82 |
def download_and_process_repo(repo_url: str, branch_or_tag: str, log: ui.log) -> str | None:
|
| 83 |
"""
|
|
@@ -225,4 +225,4 @@ def main_page():
|
|
| 225 |
|
| 226 |
|
| 227 |
# NiceGUI application on port 8080
|
| 228 |
-
ui.run(
|
|
|
|
| 8 |
import tiktoken
|
| 9 |
|
| 10 |
|
| 11 |
+
# --- Core Helper Functions ---
|
| 12 |
|
| 13 |
def is_file_type(file_path: str, file_extension: str) -> bool:
|
| 14 |
"""Check if the file has the specified file extension."""
|
|
|
|
| 65 |
return False
|
| 66 |
|
| 67 |
|
| 68 |
+
# --- Token Calculation Function ---
|
| 69 |
def get_token_count(text: str) -> int:
|
| 70 |
"""Calculates the number of tokens in a string using the cl100k_base encoding."""
|
| 71 |
try:
|
|
|
|
| 77 |
return 0
|
| 78 |
|
| 79 |
|
| 80 |
+
# --- Core Processing Logic ---
|
| 81 |
|
| 82 |
def download_and_process_repo(repo_url: str, branch_or_tag: str, log: ui.log) -> str | None:
|
| 83 |
"""
|
|
|
|
| 225 |
|
| 226 |
|
| 227 |
# NiceGUI application on port 8080
|
| 228 |
+
ui.run()
|