Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -91,18 +91,29 @@ example_images = [
|
|
91 |
"https://apnapestcontrol.ca/wp-content/uploads/2019/02/9.jpg",
|
92 |
"https://images.pexels.com/photos/1107717/pexels-photo-1107717.jpeg?cs=srgb&dl=pexels-fotios-photos-1107717.jpg&fm=jpg"
|
93 |
]
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
iface = gr.Interface(
|
97 |
fn=predict_emotion,
|
98 |
inputs=gr.Image(type="pil", label="Upload an Image"),
|
99 |
outputs=[gr.Textbox(label="Emotion"), gr.Textbox(label="Memorability Score")],
|
100 |
-
title="
|
101 |
-
description="
|
102 |
-
examples=example_images
|
|
|
103 |
)
|
104 |
|
105 |
|
106 |
-
|
107 |
if __name__ == "__main__":
|
108 |
iface.launch()
|
|
|
91 |
"https://apnapestcontrol.ca/wp-content/uploads/2019/02/9.jpg",
|
92 |
"https://images.pexels.com/photos/1107717/pexels-photo-1107717.jpeg?cs=srgb&dl=pexels-fotios-photos-1107717.jpg&fm=jpg"
|
93 |
]
|
94 |
+
css = """
|
95 |
+
.gradio-container {
|
96 |
+
display: flex;
|
97 |
+
flex-direction: column;
|
98 |
+
align-items: center;
|
99 |
+
justify-content: center;
|
100 |
+
}
|
101 |
+
.gradio-title, .gradio-description {
|
102 |
+
text-align: center;
|
103 |
+
}
|
104 |
+
"""
|
105 |
+
|
106 |
+
# Create Gradio interface with custom CSS
|
107 |
iface = gr.Interface(
|
108 |
fn=predict_emotion,
|
109 |
inputs=gr.Image(type="pil", label="Upload an Image"),
|
110 |
outputs=[gr.Textbox(label="Emotion"), gr.Textbox(label="Memorability Score")],
|
111 |
+
title="PerceptCLIP",
|
112 |
+
description="This is an official demo of PerceptCLIP from the paper: [Don’t Judge Before You CLIP: A Unified Approach for Perceptual Tasks](https://arxiv.org/pdf/2503.13260). For each specific task, we fine-tune CLIP with LoRA and an MLP head. Our models achieve state-of-the-art performance. \nThis demo shows results from three models, one for each task - visual emotion analysis, memorability prediction, and image quality assessment.",
|
113 |
+
examples=example_images,
|
114 |
+
css=css # Inject the custom CSS
|
115 |
)
|
116 |
|
117 |
|
|
|
118 |
if __name__ == "__main__":
|
119 |
iface.launch()
|