Spaces:
Running
Running
Style Changes
Browse files- core/model_loader.py +7 -5
- ui/layout.py +1 -2
- ui/styles.py +21 -0
core/model_loader.py
CHANGED
|
@@ -15,11 +15,12 @@ PROMPTS = {
|
|
| 15 |
}
|
| 16 |
|
| 17 |
def load_model():
|
| 18 |
-
processor = BlipProcessor.from_pretrained(MODEL_ID)
|
| 19 |
-
model = BlipForConditionalGeneration.from_pretrained(MODEL_ID)
|
| 20 |
-
model.to(DEVICE)
|
| 21 |
-
model.eval()
|
| 22 |
-
return model, processor
|
|
|
|
| 23 |
|
| 24 |
def generate_caption(
|
| 25 |
model,
|
|
@@ -27,6 +28,7 @@ def generate_caption(
|
|
| 27 |
image,
|
| 28 |
style
|
| 29 |
):
|
|
|
|
| 30 |
prompt = PROMPTS.get(style, "this image shows")
|
| 31 |
|
| 32 |
inputs = processor(
|
|
|
|
| 15 |
}
|
| 16 |
|
| 17 |
def load_model():
|
| 18 |
+
# processor = BlipProcessor.from_pretrained(MODEL_ID)
|
| 19 |
+
# model = BlipForConditionalGeneration.from_pretrained(MODEL_ID)
|
| 20 |
+
# model.to(DEVICE)
|
| 21 |
+
# model.eval()
|
| 22 |
+
# return model, processor
|
| 23 |
+
return None, None
|
| 24 |
|
| 25 |
def generate_caption(
|
| 26 |
model,
|
|
|
|
| 28 |
image,
|
| 29 |
style
|
| 30 |
):
|
| 31 |
+
return "Dummay Text"
|
| 32 |
prompt = PROMPTS.get(style, "this image shows")
|
| 33 |
|
| 34 |
inputs = processor(
|
ui/layout.py
CHANGED
|
@@ -43,8 +43,7 @@ def build_ui(model, processor):
|
|
| 43 |
)
|
| 44 |
|
| 45 |
# RIGHT: Controls + Output (Fixed)
|
| 46 |
-
with gr.Column(scale=1, min_width=420):
|
| 47 |
-
|
| 48 |
style_select = gr.Dropdown(
|
| 49 |
choices=[
|
| 50 |
"Short Caption",
|
|
|
|
| 43 |
)
|
| 44 |
|
| 45 |
# RIGHT: Controls + Output (Fixed)
|
| 46 |
+
with gr.Column(scale=1, min_width=420, elem_id="right-panel"):
|
|
|
|
| 47 |
style_select = gr.Dropdown(
|
| 48 |
choices=[
|
| 49 |
"Short Caption",
|
ui/styles.py
CHANGED
|
@@ -32,4 +32,25 @@ CSS_STYLE = """
|
|
| 32 |
flex-direction: column;
|
| 33 |
}
|
| 34 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
"""
|
|
|
|
| 32 |
flex-direction: column;
|
| 33 |
}
|
| 34 |
}
|
| 35 |
+
|
| 36 |
+
/* Reduce vertical gaps in right panel */
|
| 37 |
+
#right-panel .gradio-form {
|
| 38 |
+
gap: 8px !important;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
/* Tighten spacing between label and component */
|
| 42 |
+
#right-panel label {
|
| 43 |
+
margin-bottom: 4px !important;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/* Remove excess top spacing above textbox */
|
| 47 |
+
#output-box {
|
| 48 |
+
margin-top: -4px !important;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
/* Compact textbox padding slightly */
|
| 52 |
+
#output-box textarea {
|
| 53 |
+
padding-top: 8px !important;
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
"""
|