Akbartus commited on
Commit
3b11899
1 Parent(s): 4ba6753

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -23,8 +23,6 @@ async def generate_image(prompt, model, lora_word, width, height, scales, steps,
23
  if seed == -1:
24
  seed = random.randint(0, MAX_SEED)
25
  seed = int(seed)
26
- print("Console logging is functional.")
27
- print(f"Selected Seed: {seed}") # Print the seed
28
  text = str(Translator().translate(prompt, 'English')) + "," + lora_word
29
  client = AsyncInferenceClient()
30
  image = await client.text_to_image(prompt=text, height=height, width=width, guidance_scale=scales, num_inference_steps=steps, model=model)
@@ -44,13 +42,10 @@ def get_upscale_finegrain(prompt, img_path, upscale_factor):
44
 
45
  async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_factor, process_upscale, lora_model, process_lora):
46
  model = enable_lora(lora_model, basemodel) if process_lora else basemodel
47
- image, selected_seed = await generate_image(prompt, model, "", width, height, scales, steps, seed)
48
  if image is None:
49
- print(f"Error: Image generation failed with seed {selected_seed}")
50
  return [None, None]
51
- print(f"Selected Seed: {selected_seed}") # Log after completion
52
- sys.stdout.flush() # Ensure immediate console output
53
-
54
  image_path = "temp_image.jpg"
55
  image.save(image_path, format="JPEG")
56
 
@@ -66,7 +61,6 @@ async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_fac
66
  else:
67
  return [image_path, image_path]
68
 
69
-
70
  css = """
71
  #col-container{ margin: 0 auto; max-width: 1024px;}
72
  """
 
23
  if seed == -1:
24
  seed = random.randint(0, MAX_SEED)
25
  seed = int(seed)
 
 
26
  text = str(Translator().translate(prompt, 'English')) + "," + lora_word
27
  client = AsyncInferenceClient()
28
  image = await client.text_to_image(prompt=text, height=height, width=width, guidance_scale=scales, num_inference_steps=steps, model=model)
 
42
 
43
  async def gen(prompt, basemodel, width, height, scales, steps, seed, upscale_factor, process_upscale, lora_model, process_lora):
44
  model = enable_lora(lora_model, basemodel) if process_lora else basemodel
45
+ image, seed = await generate_image(prompt, model, "", width, height, scales, steps, seed)
46
  if image is None:
 
47
  return [None, None]
48
+
 
 
49
  image_path = "temp_image.jpg"
50
  image.save(image_path, format="JPEG")
51
 
 
61
  else:
62
  return [image_path, image_path]
63
 
 
64
  css = """
65
  #col-container{ margin: 0 auto; max-width: 1024px;}
66
  """