fffiloni commited on
Commit
192f60f
1 Parent(s): bf99f41

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -40,13 +40,14 @@ def infer(image_path, prompt, orbit_type, progress=gr.Progress(track_tqdm=True))
40
  adapter_name = None
41
  if orbit_type == "Left":
42
  weight_name = "orbit_left_lora_weights.safetensors"
43
- adapter_name = "orbit_left_lora_weights"
44
  elif orbit_type == "Up":
45
  weight_name = "orbit_up_lora_weights.safetensors"
46
- adapter_name = "orbit_up_lora_weights"
47
  lora_rank = 256
48
 
49
- pipe.load_lora_weights(lora_path, weight_name=weight_name, adapter_name=adapter_name)
 
 
 
50
  pipe.fuse_lora(lora_scale=1 / lora_rank)
51
  pipe.to("cuda")
52
 
@@ -96,7 +97,7 @@ with gr.Blocks() as demo:
96
  with gr.Column():
97
  image_in = gr.Image(label="Image Input", type="filepath")
98
  prompt = gr.Textbox(label="Prompt")
99
- orbit_type = gr.Radio(label="Orbit type", choices=["Left", "Up"], value="Left", interactive=False)
100
  submit_btn = gr.Button("Submit")
101
  with gr.Column():
102
  video_out = gr.Video(label="Video output")
 
40
  adapter_name = None
41
  if orbit_type == "Left":
42
  weight_name = "orbit_left_lora_weights.safetensors"
 
43
  elif orbit_type == "Up":
44
  weight_name = "orbit_up_lora_weights.safetensors"
 
45
  lora_rank = 256
46
 
47
+ # Generate a timestamp for adapter_name
48
+ adapter_timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
49
+
50
+ pipe.load_lora_weights(lora_path, weight_name=weight_name, adapter_name=f"adapter_name_{adapter_timestamp}")
51
  pipe.fuse_lora(lora_scale=1 / lora_rank)
52
  pipe.to("cuda")
53
 
 
97
  with gr.Column():
98
  image_in = gr.Image(label="Image Input", type="filepath")
99
  prompt = gr.Textbox(label="Prompt")
100
+ orbit_type = gr.Radio(label="Orbit type", choices=["Left", "Up"], value="Left", interactive=True)
101
  submit_btn = gr.Button("Submit")
102
  with gr.Column():
103
  video_out = gr.Video(label="Video output")