Spaces:
Running
on
Zero
Running
on
Zero
gokaygokay
commited on
Commit
•
6cfd7ba
1
Parent(s):
b8d6ed2
Update app.py
Browse files
app.py
CHANGED
@@ -8,6 +8,7 @@ import random
|
|
8 |
import numpy as np
|
9 |
import os
|
10 |
import subprocess
|
|
|
11 |
|
12 |
# Install flash-attn
|
13 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
@@ -31,6 +32,13 @@ enhancer_long = pipeline("summarization", model="gokaygokay/Lamini-Prompt-Enchan
|
|
31 |
MAX_SEED = np.iinfo(np.int32).max
|
32 |
MAX_IMAGE_SIZE = 1024
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
# Florence caption function
|
35 |
@spaces.GPU
|
36 |
def florence_caption(image):
|
@@ -61,7 +69,7 @@ def enhance_prompt(input_prompt):
|
|
61 |
enhanced_text = result[0]['summary_text']
|
62 |
return enhanced_text
|
63 |
|
64 |
-
@spaces.GPU(duration=
|
65 |
def process_workflow(image, text_prompt, use_enhancer, seed, randomize_seed, width, height, guidance_scale, num_inference_steps, negative_prompt="", progress=gr.Progress(track_tqdm=True)):
|
66 |
if image is not None:
|
67 |
# Convert image to PIL if it's not already
|
@@ -125,7 +133,7 @@ with gr.Blocks(css=custom_css, theme=gr.themes.Soft(primary_hue="blue", secondar
|
|
125 |
with gr.Row():
|
126 |
with gr.Column(scale=1):
|
127 |
with gr.Group(elem_classes="input-group"):
|
128 |
-
input_image = gr.Image(label="Input Image (Florence-2 Captioner)")
|
129 |
|
130 |
with gr.Accordion("Advanced Settings", open=False):
|
131 |
text_prompt = gr.Textbox(label="Text Prompt (optional, used if no image is uploaded)")
|
|
|
8 |
import numpy as np
|
9 |
import os
|
10 |
import subprocess
|
11 |
+
from huggingface_hub import hf_hub_download
|
12 |
|
13 |
# Install flash-attn
|
14 |
subprocess.run('pip install flash-attn --no-build-isolation', env={'FLASH_ATTENTION_SKIP_CUDA_BUILD': "TRUE"}, shell=True)
|
|
|
32 |
MAX_SEED = np.iinfo(np.int32).max
|
33 |
MAX_IMAGE_SIZE = 1024
|
34 |
|
35 |
+
hf_hub_download(
|
36 |
+
repo_id="stabilityai/stable-diffusion-3.5-large-turbo",
|
37 |
+
filename="LICENSE.md",
|
38 |
+
local_dir = "./models",
|
39 |
+
token = huggingface_token
|
40 |
+
)
|
41 |
+
|
42 |
# Florence caption function
|
43 |
@spaces.GPU
|
44 |
def florence_caption(image):
|
|
|
69 |
enhanced_text = result[0]['summary_text']
|
70 |
return enhanced_text
|
71 |
|
72 |
+
@spaces.GPU(duration=60)
|
73 |
def process_workflow(image, text_prompt, use_enhancer, seed, randomize_seed, width, height, guidance_scale, num_inference_steps, negative_prompt="", progress=gr.Progress(track_tqdm=True)):
|
74 |
if image is not None:
|
75 |
# Convert image to PIL if it's not already
|
|
|
133 |
with gr.Row():
|
134 |
with gr.Column(scale=1):
|
135 |
with gr.Group(elem_classes="input-group"):
|
136 |
+
input_image = gr.Image(label="Input Image (Florence-2 Captioner)", height=512)
|
137 |
|
138 |
with gr.Accordion("Advanced Settings", open=False):
|
139 |
text_prompt = gr.Textbox(label="Text Prompt (optional, used if no image is uploaded)")
|