DreamingOracle commited on
Commit
2f8202d
·
verified ·
1 Parent(s): 3dc4c5d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -7
app.py CHANGED
@@ -11,16 +11,19 @@ from PIL import Image, ImageFilter, ImageOps
11
  from huggingface_hub import login, hf_hub_download
12
  import os
13
 
14
- # Log auth config
 
 
 
15
  if "HF_TOKEN" in os.environ:
16
  login(os.environ["HF_TOKEN"])
17
  else:
18
  raise ValueError("HF_TOKEN not found in environment variables. Please set it in Space settings.")
19
 
20
  device = "cuda" if torch.cuda.is_available() else "cpu"
21
- # dl
22
- repo_id = "DreamingOracle/Quagmaform_alpha-1" # dl proprietary
23
- filename = "DPS_Quagmaform_Alpha1.safetensors" # dl from source proprietary
24
  model_path = hf_hub_download(repo_id=repo_id, filename=filename)
25
  if torch.cuda.is_available():
26
  torch_dtype = torch.float16
@@ -76,7 +79,7 @@ def infer(
76
  # 1) Pad bbox so inpaint has surrounding context
77
  w = max(1, x2 - x1)
78
  h = max(1, y2 - y1)
79
- pad = int(max(10, 0.18 * max(w, h))) # ~18% padding, tweak if desired
80
  x1p = max(0, x1 - pad)
81
  y1p = max(0, y1 - pad)
82
  x2p = min(image.width, x2 + pad)
@@ -130,11 +133,14 @@ def infer(
130
  examples = [
131
  "photorealistic portrait of a young woman, cinematic rim lighting, soft golden hour backlight, detailed skin pores, realistic eyelashes, 85mm lens, shallow depth of field, ultra-detailed, high dynamic range, film grain, detailed, 8k",
132
  "head helmet portrait of a futuristic armored soldier, worn brushed metal armor with neon blue accents, realistic cloth under-armor, weathering and scratches, volumetric rim light, cinematic pose, high detail, photoreal",
133
- "silver bars stacked in a metal case, neon cyberpunk theme, rainbow glare effect, cinematic composition, realistic depth, crisp details",]
134
 
135
  css = """#col-container { margin: 0 auto; max-width: 640px;}"""
136
 
137
- with gr.Blocks(css=css) as demo:
 
 
 
138
  with gr.Column(elem_id="col-container"):
139
  gr.Markdown(" # DPS-Quagmaform AI txt2img")
140
  with gr.Row():
 
11
  from huggingface_hub import login, hf_hub_download
12
  import os
13
 
14
+ # Add this import for theming
15
+ from gradio import themes
16
+
17
+
18
  if "HF_TOKEN" in os.environ:
19
  login(os.environ["HF_TOKEN"])
20
  else:
21
  raise ValueError("HF_TOKEN not found in environment variables. Please set it in Space settings.")
22
 
23
  device = "cuda" if torch.cuda.is_available() else "cpu"
24
+
25
+ repo_id = "DreamingOracle/Quagmaform_alpha-1"
26
+ filename = "DPS_Quagmaform_Alpha1.safetensors"
27
  model_path = hf_hub_download(repo_id=repo_id, filename=filename)
28
  if torch.cuda.is_available():
29
  torch_dtype = torch.float16
 
79
  # 1) Pad bbox so inpaint has surrounding context
80
  w = max(1, x2 - x1)
81
  h = max(1, y2 - y1)
82
+ pad = int(max(10, 0.18 * max(w, h))) # ~18% padding, tweak if desired to lower value for scenic panorama preservation
83
  x1p = max(0, x1 - pad)
84
  y1p = max(0, y1 - pad)
85
  x2p = min(image.width, x2 + pad)
 
133
  examples = [
134
  "photorealistic portrait of a young woman, cinematic rim lighting, soft golden hour backlight, detailed skin pores, realistic eyelashes, 85mm lens, shallow depth of field, ultra-detailed, high dynamic range, film grain, detailed, 8k",
135
  "head helmet portrait of a futuristic armored soldier, worn brushed metal armor with neon blue accents, realistic cloth under-armor, weathering and scratches, volumetric rim light, cinematic pose, high detail, photoreal",
136
+ "close up view of silver coins on a table",]
137
 
138
  css = """#col-container { margin: 0 auto; max-width: 640px;}"""
139
 
140
+ # Create the custom purple theme
141
+ custom_theme = themes.Default(primary_hue="purple")
142
+
143
+ with gr.Blocks(css=css, theme=custom_theme) as demo:
144
  with gr.Column(elem_id="col-container"):
145
  gr.Markdown(" # DPS-Quagmaform AI txt2img")
146
  with gr.Row():