Matheus Rech commited on
Commit
2d48dca
·
unverified ·
2 Parent(s): d7b8585 17e5a51

Merge pull request #4 from matheus-rech/copilot/fix-hf-main-reference-bug

Browse files
Files changed (3) hide show
  1. .github/workflows/sync-to-hf.yml +18 -1
  2. app.py +2 -0
  3. requirements.txt +1 -0
.github/workflows/sync-to-hf.yml CHANGED
@@ -62,7 +62,24 @@ jobs:
62
  run: |
63
  echo "Pushing to Hugging Face..."
64
  # Use --force-with-lease for safer force push that checks remote hasn't changed
65
- if git push hf main --force-with-lease=main:hf/main 2>&1 | tee push_output.log; then
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  echo "✓ Successfully pushed to Hugging Face"
67
  else
68
  echo "::error::Failed to push to Hugging Face"
 
62
  run: |
63
  echo "Pushing to Hugging Face..."
64
  # Use --force-with-lease for safer force push that checks remote hasn't changed
65
+ # Check if hf/main ref exists to determine the correct syntax
66
+ if git rev-parse hf/main >/dev/null 2>&1; then
67
+ # hf/main exists - use explicit ref syntax to ensure remote hasn't changed
68
+ if git push hf main --force-with-lease=main:hf/main 2>&1 | tee push_output.log; then
69
+ PUSH_SUCCESS=true
70
+ else
71
+ PUSH_SUCCESS=false
72
+ fi
73
+ else
74
+ # hf/main doesn't exist (first push) - use simple syntax
75
+ if git push hf main --force-with-lease 2>&1 | tee push_output.log; then
76
+ PUSH_SUCCESS=true
77
+ else
78
+ PUSH_SUCCESS=false
79
+ fi
80
+ fi
81
+
82
+ if [ "$PUSH_SUCCESS" = "true" ]; then
83
  echo "✓ Successfully pushed to Hugging Face"
84
  else
85
  echo "::error::Failed to push to Hugging Face"
app.py CHANGED
@@ -11,6 +11,7 @@ import json
11
  import time
12
  from datetime import datetime
13
  import gradio as gr
 
14
  import torch
15
  import pydicom
16
  import numpy as np
@@ -93,6 +94,7 @@ else:
93
  model = None
94
  processor = None
95
 
 
96
  def run_sam3_inference(pil_image, prompt_text, threshold=0.5, mask_threshold=0.5):
97
  """
98
  Run SAM 3 inference - matching official implementation from akhaliq/sam3.
 
11
  import time
12
  from datetime import datetime
13
  import gradio as gr
14
+ import spaces
15
  import torch
16
  import pydicom
17
  import numpy as np
 
94
  model = None
95
  processor = None
96
 
97
+ @spaces.GPU(duration=60)
98
  def run_sam3_inference(pil_image, prompt_text, threshold=0.5, mask_threshold=0.5):
99
  """
100
  Run SAM 3 inference - matching official implementation from akhaliq/sam3.
requirements.txt CHANGED
@@ -9,4 +9,5 @@ git+https://github.com/huggingface/transformers.git
9
  huggingface-hub>=0.20.0
10
  nibabel>=5.0.0
11
  scipy>=1.10.0
 
12
 
 
9
  huggingface-hub>=0.20.0
10
  nibabel>=5.0.0
11
  scipy>=1.10.0
12
+ spaces
13