prithivMLmods commited on
Commit
33db9df
·
verified ·
1 Parent(s): c5967fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -2
app.py CHANGED
@@ -214,10 +214,22 @@ def infer(
214
  progress(0.9, desc="Preparing Rerun Visualization...")
215
 
216
  run_id = str(uuid.uuid4())
217
- rec = rr.new_recording(application_id="Qwen-Image-Edit", recording_id=run_id)
218
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  # Log images to Rerun
220
- # We convert PIL images to numpy arrays for Rerun
221
  rec.log("images/original", rr.Image(np.array(original_image)))
222
  rec.log("images/edited", rr.Image(np.array(result_image)))
223
 
 
214
  progress(0.9, desc="Preparing Rerun Visualization...")
215
 
216
  run_id = str(uuid.uuid4())
 
217
 
218
+ # Handle different Rerun SDK versions robustly
219
+ rec = None
220
+ if hasattr(rr, "new_recording"):
221
+ # Newer Rerun versions
222
+ rec = rr.new_recording(application_id="Qwen-Image-Edit", recording_id=run_id)
223
+ elif hasattr(rr, "RecordingStream"):
224
+ # Alternative direct class instantiation
225
+ rec = rr.RecordingStream(application_id="Qwen-Image-Edit", recording_id=run_id)
226
+ else:
227
+ # Fallback for older versions or simple scripts (Global State)
228
+ rr.init("Qwen-Image-Edit", recording_id=run_id, spawn=False)
229
+ rec = rr
230
+
231
  # Log images to Rerun
232
+ # rec.log handles logging for both RecordingStream objects and the global rr module
233
  rec.log("images/original", rr.Image(np.array(original_image)))
234
  rec.log("images/edited", rr.Image(np.array(result_image)))
235