espejelomar commited on
Commit
20b860f
·
verified ·
1 Parent(s): 0faf251

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. 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
- # Read GitHub handles from input text or uploaded file
25
  if uploaded_file is not None:
26
  print(colored("Reading from uploaded file...", "blue"))
27
- input_text = uploaded_file.read().decode("utf-8")
28
- github_handles = [handle.strip() for handle in input_text.split(",")]
 
 
 
 
 
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