Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -129,29 +129,18 @@ def predict(image: Image.Image, text: str) -> str:
|
|
129 |
)
|
130 |
predicted_class = torch.sigmoid(classification_output).round().item()
|
131 |
|
132 |
-
return "
|
133 |
-
|
134 |
-
# Custom Theme
|
135 |
-
theme = gr.themes.Base(
|
136 |
-
primary_hue="slate",
|
137 |
-
secondary_hue="blue",
|
138 |
-
neutral_hue="gray",
|
139 |
-
text_size="lg",
|
140 |
-
radius_size="md",
|
141 |
-
font=["Roboto", "sans-serif"]
|
142 |
-
)
|
143 |
|
144 |
# Gradio Interface
|
145 |
interface = gr.Interface(
|
146 |
fn=predict,
|
147 |
inputs=[
|
148 |
-
gr.Image(type="pil", label="Upload
|
149 |
-
gr.Textbox(lines=2, placeholder="Enter
|
150 |
],
|
151 |
outputs=gr.Label(label="Prediction"),
|
152 |
-
title="
|
153 |
-
description="Upload an image and provide text to classify
|
154 |
-
theme=theme
|
155 |
)
|
156 |
|
157 |
interface.launch()
|
|
|
129 |
)
|
130 |
predicted_class = torch.sigmoid(classification_output).round().item()
|
131 |
|
132 |
+
return "Biased" if predicted_class == 1 else "Unbiased"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
|
134 |
# Gradio Interface
|
135 |
interface = gr.Interface(
|
136 |
fn=predict,
|
137 |
inputs=[
|
138 |
+
gr.Image(type="pil", label="Upload Image"),
|
139 |
+
gr.Textbox(lines=2, placeholder="Enter text for classification...", label="Input Text")
|
140 |
],
|
141 |
outputs=gr.Label(label="Prediction"),
|
142 |
+
title="Multimodal Bias Classifier",
|
143 |
+
description="Upload an image and provide a text to classify it as 'Biased' or 'Unbiased'."
|
|
|
144 |
)
|
145 |
|
146 |
interface.launch()
|