Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- github_metrics/main.py +8 -3
github_metrics/main.py
CHANGED
|
@@ -21,11 +21,16 @@ def process_input(input_text, uploaded_file):
|
|
| 21 |
try:
|
| 22 |
print(colored("Processing input...", "blue"))
|
| 23 |
|
| 24 |
-
#
|
| 25 |
if uploaded_file is not None:
|
| 26 |
print(colored("Reading from uploaded file...", "blue"))
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
print(colored(f"GitHub handles: {github_handles}", "blue"))
|
| 30 |
|
| 31 |
# Load dataset
|
|
|
|
| 21 |
try:
|
| 22 |
print(colored("Processing input...", "blue"))
|
| 23 |
|
| 24 |
+
# Check if a file was uploaded
|
| 25 |
if uploaded_file is not None:
|
| 26 |
print(colored("Reading from uploaded file...", "blue"))
|
| 27 |
+
# Decode the bytes object to string
|
| 28 |
+
file_content = uploaded_file.decode("utf-8")
|
| 29 |
+
# Split the content by newlines and strip each handle
|
| 30 |
+
github_handles = [handle.strip() for handle in file_content.split('\n') if handle.strip()]
|
| 31 |
+
else:
|
| 32 |
+
github_handles = [handle.strip() for handle in input_text.split(",")]
|
| 33 |
+
|
| 34 |
print(colored(f"GitHub handles: {github_handles}", "blue"))
|
| 35 |
|
| 36 |
# Load dataset
|