killwithabass commited on
Commit
e0e09c3
Β·
verified Β·
1 Parent(s): 02b6311

Update app.py

Browse files

add log of the file

Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -4,6 +4,7 @@ import torch
4
  from PIL import Image
5
  from diffusers import DiffusionPipeline
6
  import random
 
7
 
8
  # Initialize the base model and specific LoRA
9
  base_model = "black-forest-labs/FLUX.1-dev"
@@ -47,6 +48,19 @@ def run_lora(prompt, cfg_scale, steps, randomize_seed, seed, width, height, lora
47
  joint_attention_kwargs={"scale": lora_scale},
48
  ).images[0]
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  # Final update (100%)
51
  progress(100, "Completed!")
52
 
 
4
  from PIL import Image
5
  from diffusers import DiffusionPipeline
6
  import random
7
+ from datetime import datetime
8
 
9
  # Initialize the base model and specific LoRA
10
  base_model = "black-forest-labs/FLUX.1-dev"
 
48
  joint_attention_kwargs={"scale": lora_scale},
49
  ).images[0]
50
 
51
+ # Save the image to a file with a unique name in /tmp directory
52
+ timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
53
+ image_filename = f"generated_image_{timestamp}.png"
54
+ image_path = os.path.join("/tmp/gradio", image_filename)
55
+ image.save(image_path)
56
+
57
+ # Construct the URL to access the image
58
+ space_url = "https://killwithabass-flux-1-dev-lora-androflux.hf.space" # Replace with your actual space URL
59
+ image_url = f"{space_url}/file={image_path}"
60
+
61
+ # Log the file URL
62
+ print(f"Image URL: {image_url}")
63
+
64
  # Final update (100%)
65
  progress(100, "Completed!")
66