Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -161,7 +161,7 @@ import os
|
|
161 |
import subprocess
|
162 |
import sys
|
163 |
# Run the .bat file before launching the app
|
164 |
-
try:
|
165 |
import PromptTrack
|
166 |
except ImportError:
|
167 |
print("PromptTrack not found. Installing...")
|
@@ -175,7 +175,7 @@ except ImportError:
|
|
175 |
|
176 |
|
177 |
from PromptTrack import PromptTracker
|
178 |
-
tracker = PromptTracker()
|
179 |
def process_video(video_path, prompt):
|
180 |
detection_threshold=0.3
|
181 |
track_thresh=0.4
|
@@ -186,21 +186,21 @@ def process_video(video_path, prompt):
|
|
186 |
output_file = video_path.split('mp4')[0]+"_mot_.json" # Tracking result
|
187 |
output_file_2 = video_path.split('mp4')[0]+"_object_detection.json" # detection results
|
188 |
video_file = video_path
|
189 |
-
tracker.detect_objects(video_file, prompt=prompt, nms_threshold=0.8, detection_threshold=detection_threshold, detector="OWL-VITV2")
|
190 |
tracker.process_mot(video_file, fixed_parc=True, track_thresh=track_thresh, match_thresh=match_thresh, frame_rate=25, max_time_lost=max_time_lost, nbr_frames_fixing=nbr_frames_fixing)
|
191 |
-
tracker.read_video_with_mot(video_file, fps=25)
|
192 |
|
193 |
|
194 |
-
|
195 |
output_file = "output.txt" # Placeholder for generated file
|
196 |
|
197 |
-
|
198 |
-
|
199 |
shutil.copy(video_path.name, output_video)
|
200 |
|
201 |
# Create an output text file with the prompt content
|
202 |
with open(output_file, "w") as f:
|
203 |
-
f.write(f"User Prompt: {prompt}\n")
|
204 |
|
205 |
return output_video, output_file
|
206 |
|
@@ -216,7 +216,7 @@ iface = gr.Interface(
|
|
216 |
|
217 |
# Launch the app
|
218 |
if __name__ == "__main__":
|
219 |
-
iface.launch()
|
220 |
|
221 |
|
222 |
'''
|
|
|
161 |
import subprocess
|
162 |
import sys
|
163 |
# Run the .bat file before launching the app
|
164 |
+
"""try:
|
165 |
import PromptTrack
|
166 |
except ImportError:
|
167 |
print("PromptTrack not found. Installing...")
|
|
|
175 |
|
176 |
|
177 |
from PromptTrack import PromptTracker
|
178 |
+
tracker = PromptTracker()"""
|
179 |
def process_video(video_path, prompt):
|
180 |
detection_threshold=0.3
|
181 |
track_thresh=0.4
|
|
|
186 |
output_file = video_path.split('mp4')[0]+"_mot_.json" # Tracking result
|
187 |
output_file_2 = video_path.split('mp4')[0]+"_object_detection.json" # detection results
|
188 |
video_file = video_path
|
189 |
+
"""tracker.detect_objects(video_file, prompt=prompt, nms_threshold=0.8, detection_threshold=detection_threshold, detector="OWL-VITV2")
|
190 |
tracker.process_mot(video_file, fixed_parc=True, track_thresh=track_thresh, match_thresh=match_thresh, frame_rate=25, max_time_lost=max_time_lost, nbr_frames_fixing=nbr_frames_fixing)
|
191 |
+
tracker.read_video_with_mot(video_file, fps=25)"""
|
192 |
|
193 |
|
194 |
+
output_video = "output.mp4" # Placeholder for processed video
|
195 |
output_file = "output.txt" # Placeholder for generated file
|
196 |
|
197 |
+
|
198 |
+
# Copy the input video to simulate processing
|
199 |
shutil.copy(video_path.name, output_video)
|
200 |
|
201 |
# Create an output text file with the prompt content
|
202 |
with open(output_file, "w") as f:
|
203 |
+
f.write(f"User Prompt: {prompt}\n")
|
204 |
|
205 |
return output_video, output_file
|
206 |
|
|
|
216 |
|
217 |
# Launch the app
|
218 |
if __name__ == "__main__":
|
219 |
+
iface.launch(share=True)
|
220 |
|
221 |
|
222 |
'''
|