updated
Browse files
app.py
CHANGED
@@ -20,6 +20,30 @@ def load_environment():
|
|
20 |
|
21 |
return os.getenv("HF_TOKEN")
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
def query_hf_api(
|
24 |
prompt: str,
|
25 |
model_url: str = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0",
|
|
|
20 |
|
21 |
return os.getenv("HF_TOKEN")
|
22 |
|
23 |
+
def craft_realistic_prompt(base_prompt: str) -> str:
|
24 |
+
"""
|
25 |
+
Enhance prompts for more photorealistic results
|
26 |
+
|
27 |
+
Args:
|
28 |
+
base_prompt (str): Original user prompt
|
29 |
+
|
30 |
+
Returns:
|
31 |
+
str: Enhanced, detailed prompt
|
32 |
+
"""
|
33 |
+
realistic_modifiers = [
|
34 |
+
"photorealistic",
|
35 |
+
"high resolution",
|
36 |
+
"sharp focus",
|
37 |
+
"professional photography",
|
38 |
+
"natural lighting",
|
39 |
+
"detailed textures"
|
40 |
+
]
|
41 |
+
|
42 |
+
# Combine base prompt with realistic modifiers
|
43 |
+
enhanced_prompt = f"{' '.join(realistic_modifiers)}, {base_prompt}, shot on professional camera, 8k resolution"
|
44 |
+
|
45 |
+
return enhanced_prompt
|
46 |
+
|
47 |
def query_hf_api(
|
48 |
prompt: str,
|
49 |
model_url: str = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-xl-base-1.0",
|