Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -45,18 +45,29 @@ def analyze_text(text):
|
|
45 |
)
|
46 |
return response.text if response else "No response generated."
|
47 |
|
48 |
-
#
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
# Gradio interface setup
|
59 |
-
with gr.Blocks() as app:
|
|
|
|
|
|
|
60 |
with gr.Tab("Text Analysis"):
|
61 |
text_input = gr.Textbox(label="Enter Text or Select an Example", placeholder="Type here or select an example...", lines=4)
|
62 |
analyze_text_btn = gr.Button("Analyze Text")
|
@@ -65,8 +76,7 @@ with gr.Blocks() as app:
|
|
65 |
examples = gr.Examples(
|
66 |
examples=example_scenarios,
|
67 |
inputs=text_input,
|
68 |
-
outputs=text_output
|
69 |
-
# fn=analyze_text # Automatically analyze when an example is selected
|
70 |
)
|
71 |
|
72 |
analyze_text_btn.click(
|
|
|
45 |
)
|
46 |
return response.text if response else "No response generated."
|
47 |
|
48 |
+
# Custom CSS for branding and animation
|
49 |
+
css = """
|
50 |
+
body { font-family: 'Arial', sans-serif; background-color: #f0f0f0; }
|
51 |
+
h1 { color: #333; animation: fadeIn 2s; }
|
52 |
+
@keyframes fadeIn {
|
53 |
+
from { opacity: 0; }
|
54 |
+
to { opacity: 1; }
|
55 |
+
}
|
56 |
+
#logo { font-size: 48px; color: #5f4b8b; animation: slideIn 2s; }
|
57 |
+
@keyframes slideIn {
|
58 |
+
0% { margin-left: -200px; }
|
59 |
+
100% { margin-left: 0px; }
|
60 |
+
}
|
61 |
+
.button { background-color: #4CAF50; color: white; padding: 14px 20px; margin: 8px 0; border: none; cursor: pointer; width: 100%; }
|
62 |
+
.button:hover { opacity: 0.8; }
|
63 |
+
.textbox { width: 100%; padding: 12px 20px; margin: 8px 0; display: inline-block; border: 1px solid #ccc; box-sizing: border-box; }
|
64 |
+
"""
|
65 |
|
66 |
# Gradio interface setup
|
67 |
+
with gr.Blocks(css=css) as app:
|
68 |
+
gr.Markdown("<div id='logo'>J<span>ustEva</span></div>")
|
69 |
+
gr.Markdown("<h1 style='text-align: center; color: #5f4b8b;'>Gender Bias Analysis Platform</h1>")
|
70 |
+
gr.Markdown("<p style='text-align: center; font-size: 16px; color: #4a4a4a;'>Powered by AI to advocate against gender-based violence</p>")
|
71 |
with gr.Tab("Text Analysis"):
|
72 |
text_input = gr.Textbox(label="Enter Text or Select an Example", placeholder="Type here or select an example...", lines=4)
|
73 |
analyze_text_btn = gr.Button("Analyze Text")
|
|
|
76 |
examples = gr.Examples(
|
77 |
examples=example_scenarios,
|
78 |
inputs=text_input,
|
79 |
+
outputs=text_output
|
|
|
80 |
)
|
81 |
|
82 |
analyze_text_btn.click(
|