Dede16 commited on
Commit
b8f9df4
·
verified ·
1 Parent(s): d665537

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -32,16 +32,16 @@ def palm_detection(image):
32
  # Generate a unique filename and save the annotated image
33
  unique_id = str(uuid.uuid4())
34
  filename = f"{unique_id}.jpg"
35
- _, buffer = cv2.imencode('.jpg', annotated_frame)
36
- binary_image = buffer.tobytes()
37
- repo_name = get_full_repo_name(model_id="SawitDetection", token=hf_token)
38
- img_file_url = upload_file(
39
- path_or_fileobj=binary_image,
40
- path_in_repo=filename,
41
- repo_id=repo_name,
42
- repo_type="space",
43
- token=hf_token,
44
- )
45
 
46
  # Append the results to the list
47
  results_list.append({
@@ -54,14 +54,14 @@ def palm_detection(image):
54
  results_df = pd.DataFrame(results_list)
55
  csv_filename = 'detection_results.csv'
56
  csv_output_path = os.path.join(csv_filename)
57
- results_df.to_csv(csv_output_path, index=False)
58
- csv_file_url = upload_file(
59
- path_or_fileobj=csv_output_path,
60
- path_in_repo=csv_filename,
61
- repo_id=repo_name,
62
- repo_type="space",
63
- token=hf_token,
64
- )
65
  return annotated_frame, results_df
66
 
67
  with gr.Blocks(theme = "soft", title="Palm Detector") as palm_detector:
 
32
  # Generate a unique filename and save the annotated image
33
  unique_id = str(uuid.uuid4())
34
  filename = f"{unique_id}.jpg"
35
+ #_, buffer = cv2.imencode('.jpg', annotated_frame)
36
+ #binary_image = buffer.tobytes()
37
+ #repo_name = get_full_repo_name(model_id="SawitDetection", token=hf_token)
38
+ #img_file_url = upload_file(
39
+ #path_or_fileobj=binary_image,
40
+ #path_in_repo=filename,
41
+ #repo_id=repo_name,
42
+ #repo_type="space",
43
+ #token=hf_token,
44
+ # )
45
 
46
  # Append the results to the list
47
  results_list.append({
 
54
  results_df = pd.DataFrame(results_list)
55
  csv_filename = 'detection_results.csv'
56
  csv_output_path = os.path.join(csv_filename)
57
+ #results_df.to_csv(csv_output_path, index=False)
58
+ #csv_file_url = upload_file(
59
+ # path_or_fileobj=csv_output_path,
60
+ # path_in_repo=csv_filename,
61
+ # repo_id=repo_name,
62
+ # repo_type="space",
63
+ # token=hf_token,
64
+ # )
65
  return annotated_frame, results_df
66
 
67
  with gr.Blocks(theme = "soft", title="Palm Detector") as palm_detector: