Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -26,11 +26,10 @@ qwen_model = Qwen2VLForConditionalGeneration.from_pretrained(
|
|
| 26 |
).to(device).eval()
|
| 27 |
qwen_processor = AutoProcessor.from_pretrained("prithivMLmods/JSONify-Flux", trust_remote_code=True)
|
| 28 |
|
| 29 |
-
# Prompt Enhancer
|
| 30 |
enhancer_long = pipeline("summarization", model="prithivMLmods/t5-Flan-Prompt-Enhance", device=device)
|
| 31 |
|
| 32 |
MAX_SEED = np.iinfo(np.int32).max
|
| 33 |
-
MAX_IMAGE_SIZE =
|
| 34 |
|
| 35 |
# Qwen2VL caption function – updated to request plain text caption instead of JSON
|
| 36 |
@spaces.GPU
|
|
@@ -44,7 +43,6 @@ def qwen_caption(image):
|
|
| 44 |
"role": "user",
|
| 45 |
"content": [
|
| 46 |
{"type": "image", "image": image},
|
| 47 |
-
# Removed "in the form of JSON data {}" to get plain text caption
|
| 48 |
{"type": "text", "text": "Generate a detailed and optimized caption for the given image."},
|
| 49 |
],
|
| 50 |
}
|
|
@@ -161,7 +159,7 @@ with gr.Blocks(css=custom_css) as demo:
|
|
| 161 |
width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=512)
|
| 162 |
height = gr.Slider(label="Height", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=512)
|
| 163 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=15, step=0.1, value=3.5)
|
| 164 |
-
num_inference_steps = gr.Slider(label="Inference Steps", minimum=1, maximum=50, step=1, value=
|
| 165 |
|
| 166 |
generate_btn = gr.Button("Generate Image Prompt", elem_classes="submit-btn")
|
| 167 |
|
|
|
|
| 26 |
).to(device).eval()
|
| 27 |
qwen_processor = AutoProcessor.from_pretrained("prithivMLmods/JSONify-Flux", trust_remote_code=True)
|
| 28 |
|
|
|
|
| 29 |
enhancer_long = pipeline("summarization", model="prithivMLmods/t5-Flan-Prompt-Enhance", device=device)
|
| 30 |
|
| 31 |
MAX_SEED = np.iinfo(np.int32).max
|
| 32 |
+
MAX_IMAGE_SIZE = 2048
|
| 33 |
|
| 34 |
# Qwen2VL caption function – updated to request plain text caption instead of JSON
|
| 35 |
@spaces.GPU
|
|
|
|
| 43 |
"role": "user",
|
| 44 |
"content": [
|
| 45 |
{"type": "image", "image": image},
|
|
|
|
| 46 |
{"type": "text", "text": "Generate a detailed and optimized caption for the given image."},
|
| 47 |
],
|
| 48 |
}
|
|
|
|
| 159 |
width = gr.Slider(label="Width", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=512)
|
| 160 |
height = gr.Slider(label="Height", minimum=256, maximum=MAX_IMAGE_SIZE, step=32, value=512)
|
| 161 |
guidance_scale = gr.Slider(label="Guidance Scale", minimum=1, maximum=15, step=0.1, value=3.5)
|
| 162 |
+
num_inference_steps = gr.Slider(label="Inference Steps", minimum=1, maximum=50, step=1, value=32)
|
| 163 |
|
| 164 |
generate_btn = gr.Button("Generate Image Prompt", elem_classes="submit-btn")
|
| 165 |
|