TarikDavis commited on
Commit
2c79a5e
·
verified ·
1 Parent(s): 7cf9143

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -3,6 +3,8 @@ import datetime
3
  import requests
4
  import pytz
5
  import yaml
 
 
6
  from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
@@ -34,6 +36,20 @@ def get_current_time_in_timezone(timezone: str) -> str:
34
  except Exception as e:
35
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
 
38
  final_answer = FinalAnswerTool()
39
 
 
3
  import requests
4
  import pytz
5
  import yaml
6
+ import torch
7
+ from diffusers import FluxPipeline
8
  from tools.final_answer import FinalAnswerTool
9
 
10
  from Gradio_UI import GradioUI
 
36
  except Exception as e:
37
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
38
 
39
+ pipe = FluxPipeline.from_pretrained("black-forest-labs/FLUX.1-dev", torch_dtype=torch.bfloat16)
40
+ pipe.enable_model_cpu_offload() #save some VRAM by offloading the model to CPU. Remove this if you have enough GPU power
41
+
42
+ prompt = "{local_time}"
43
+ image = pipe(
44
+ prompt,
45
+ height=1024,
46
+ width=1024,
47
+ guidance_scale=3.5,
48
+ num_inference_steps=50,
49
+ max_sequence_length=512,
50
+ generator=torch.Generator("cpu").manual_seed(0)
51
+ ).images[0]
52
+ image.save("flux-dev.png")
53
 
54
  final_answer = FinalAnswerTool()
55