Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
2cebab9
1
Parent(s):
db63048
theme
Browse files
app.py
CHANGED
|
@@ -68,6 +68,7 @@ def florence_caption(image):
|
|
| 68 |
return parsed_answer["<MORE_DETAILED_CAPTION>"]
|
| 69 |
|
| 70 |
# Prompt Enhancer function
|
|
|
|
| 71 |
def enhance_prompt(input_prompt):
|
| 72 |
result = enhancer_long("Enhance the description: " + input_prompt)
|
| 73 |
enhanced_text = result[0]['summary_text']
|
|
@@ -127,24 +128,7 @@ def generate_llm_prompt(input_text, provider, model, prompt_type):
|
|
| 127 |
except Exception as e:
|
| 128 |
print(f"An error occurred in generate_llm_prompt: {e}")
|
| 129 |
return input_text # Return original input if there's an error
|
| 130 |
-
|
| 131 |
-
custom_css = """
|
| 132 |
-
.input-group, .output-group {
|
| 133 |
-
border: 1px solid #e0e0e0;
|
| 134 |
-
border-radius: 10px;
|
| 135 |
-
padding: 20px;
|
| 136 |
-
margin-bottom: 20px;
|
| 137 |
-
background-color: #f9f9f9;
|
| 138 |
-
}
|
| 139 |
-
.submit-btn {
|
| 140 |
-
background-color: #2980b9 !important;
|
| 141 |
-
color: white !important;
|
| 142 |
-
}
|
| 143 |
-
.submit-btn:hover {
|
| 144 |
-
background-color: #3498db !important;
|
| 145 |
-
}
|
| 146 |
-
"""
|
| 147 |
-
|
| 148 |
title = """<h1 align="center">Stable Diffusion 3.5 with Florence-2 Captioner and Prompt Enhancer</h1>
|
| 149 |
<p><center>
|
| 150 |
<a href="https://huggingface.co/stabilityai/stable-diffusion-3.5-large" target="_blank">[Stable Diffusion 3.5 Model]</a>
|
|
@@ -154,7 +138,7 @@ title = """<h1 align="center">Stable Diffusion 3.5 with Florence-2 Captioner and
|
|
| 154 |
</center></p>
|
| 155 |
"""
|
| 156 |
|
| 157 |
-
with gr.Blocks(
|
| 158 |
gr.HTML(title)
|
| 159 |
|
| 160 |
with gr.Row():
|
|
|
|
| 68 |
return parsed_answer["<MORE_DETAILED_CAPTION>"]
|
| 69 |
|
| 70 |
# Prompt Enhancer function
|
| 71 |
+
@spaces.GPU
|
| 72 |
def enhance_prompt(input_prompt):
|
| 73 |
result = enhancer_long("Enhance the description: " + input_prompt)
|
| 74 |
enhanced_text = result[0]['summary_text']
|
|
|
|
| 128 |
except Exception as e:
|
| 129 |
print(f"An error occurred in generate_llm_prompt: {e}")
|
| 130 |
return input_text # Return original input if there's an error
|
| 131 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
title = """<h1 align="center">Stable Diffusion 3.5 with Florence-2 Captioner and Prompt Enhancer</h1>
|
| 133 |
<p><center>
|
| 134 |
<a href="https://huggingface.co/stabilityai/stable-diffusion-3.5-large" target="_blank">[Stable Diffusion 3.5 Model]</a>
|
|
|
|
| 138 |
</center></p>
|
| 139 |
"""
|
| 140 |
|
| 141 |
+
with gr.Blocks(theme='bethecloud/storj_theme') as demo:
|
| 142 |
gr.HTML(title)
|
| 143 |
|
| 144 |
with gr.Row():
|