Spaces:
Sleeping
Sleeping
simplify styles
Browse files- main.py +11 -3
- ui/styles.py +15 -41
main.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
# main.py
|
| 2 |
import gradio as gr
|
| 3 |
from src.analyzer import EventAnalyzer
|
| 4 |
from ui.format import ResultFormatter
|
|
@@ -16,9 +15,18 @@ async def process_input(text: str) -> str:
|
|
| 16 |
EXAMPLES = [
|
| 17 |
["John from Tech Corp. is attending the meeting in Washington, DC tomorrow at 14:30 #tech"],
|
| 18 |
["Sarah Johnson and Mike Smith from Defense Systems Inc. are conducting training in Norfolk, VA on June 15th #defense #training"],
|
| 19 |
-
["Team meeting at headquarters with @commander_smith at 0900 #briefing"]
|
|
|
|
|
|
|
|
|
|
| 20 |
]
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
# Create Gradio interface
|
| 23 |
demo = gr.Interface(
|
| 24 |
fn=process_input,
|
|
@@ -33,7 +41,7 @@ demo = gr.Interface(
|
|
| 33 |
title="Event Analysis System",
|
| 34 |
description="Analyze text to extract entities, assess confidence, and identify key event information with relationship tracking.",
|
| 35 |
css=css,
|
| 36 |
-
theme=
|
| 37 |
examples=EXAMPLES
|
| 38 |
)
|
| 39 |
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from src.analyzer import EventAnalyzer
|
| 3 |
from ui.format import ResultFormatter
|
|
|
|
| 15 |
EXAMPLES = [
|
| 16 |
["John from Tech Corp. is attending the meeting in Washington, DC tomorrow at 14:30 #tech"],
|
| 17 |
["Sarah Johnson and Mike Smith from Defense Systems Inc. are conducting training in Norfolk, VA on June 15th #defense #training"],
|
| 18 |
+
["Team meeting at headquarters with @commander_smith at 0900 #briefing"],
|
| 19 |
+
["Prof. Maria Garcia from MIT will present her research at Stanford University on quantum computing next Thursday at 15:00 PST #science #quantum"],
|
| 20 |
+
["Annual cybersecurity conference by InfoSec Systems at Dubai World Trade Centre from May 5-7, featuring keynote speaker Dr. James Wilson #security"],
|
| 21 |
+
["Emergency response drill coordinated by FEMA and local authorities in Houston, TX on April 2nd at 0800 hours #emergency #preparedness"]
|
| 22 |
]
|
| 23 |
|
| 24 |
+
# Create custom theme with better alert colors
|
| 25 |
+
theme = gr.themes.Soft(
|
| 26 |
+
primary_hue="blue",
|
| 27 |
+
secondary_hue="neutral",
|
| 28 |
+
)
|
| 29 |
+
|
| 30 |
# Create Gradio interface
|
| 31 |
demo = gr.Interface(
|
| 32 |
fn=process_input,
|
|
|
|
| 41 |
title="Event Analysis System",
|
| 42 |
description="Analyze text to extract entities, assess confidence, and identify key event information with relationship tracking.",
|
| 43 |
css=css,
|
| 44 |
+
theme=theme,
|
| 45 |
examples=EXAMPLES
|
| 46 |
)
|
| 47 |
|
ui/styles.py
CHANGED
|
@@ -7,46 +7,36 @@ css = """
|
|
| 7 |
|
| 8 |
.results {
|
| 9 |
padding: 20px;
|
| 10 |
-
border: 1px solid #ddd;
|
| 11 |
border-radius: 8px;
|
| 12 |
-
margin-top: 20px;
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
.confidence-high {
|
| 16 |
-
color: #22c55e;
|
| 17 |
-
font-weight: bold;
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
.confidence-low {
|
| 21 |
-
color: #f97316;
|
| 22 |
-
font-weight: bold;
|
| 23 |
}
|
| 24 |
|
| 25 |
.entity-section {
|
| 26 |
-
margin: 15px 0;
|
|
|
|
|
|
|
| 27 |
}
|
| 28 |
|
|
|
|
| 29 |
.alert-warning {
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
margin: 10px 0;
|
| 34 |
}
|
| 35 |
|
| 36 |
.alert-success {
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
margin: 10px 0;
|
| 41 |
}
|
| 42 |
|
| 43 |
.related-events {
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
margin-top: 15px;
|
| 48 |
}
|
| 49 |
|
|
|
|
| 50 |
.grid {
|
| 51 |
display: grid;
|
| 52 |
}
|
|
@@ -75,27 +65,11 @@ css = """
|
|
| 75 |
margin-bottom: 0.5rem;
|
| 76 |
}
|
| 77 |
|
| 78 |
-
.text-blue-600 {
|
| 79 |
-
color: #2563eb;
|
| 80 |
-
}
|
| 81 |
-
|
| 82 |
-
.text-gray-600 {
|
| 83 |
-
color: #4b5563;
|
| 84 |
-
}
|
| 85 |
-
|
| 86 |
.text-sm {
|
| 87 |
font-size: 0.875rem;
|
| 88 |
line-height: 1.25rem;
|
| 89 |
}
|
| 90 |
|
| 91 |
-
.bg-gray-50 {
|
| 92 |
-
background-color: #f9fafb;
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
.rounded-lg {
|
| 96 |
-
border-radius: 0.5rem;
|
| 97 |
-
}
|
| 98 |
-
|
| 99 |
.p-4 {
|
| 100 |
padding: 1rem;
|
| 101 |
}
|
|
|
|
| 7 |
|
| 8 |
.results {
|
| 9 |
padding: 20px;
|
|
|
|
| 10 |
border-radius: 8px;
|
| 11 |
+
margin-top: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
}
|
| 13 |
|
| 14 |
.entity-section {
|
| 15 |
+
margin: 15px 0;
|
| 16 |
+
padding: 12px;
|
| 17 |
+
border-radius: 6px;
|
| 18 |
}
|
| 19 |
|
| 20 |
+
/* Remove color definitions and let theme handle them */
|
| 21 |
.alert-warning {
|
| 22 |
+
padding: 12px;
|
| 23 |
+
border-radius: 6px;
|
| 24 |
+
margin: 12px 0;
|
|
|
|
| 25 |
}
|
| 26 |
|
| 27 |
.alert-success {
|
| 28 |
+
padding: 12px;
|
| 29 |
+
border-radius: 6px;
|
| 30 |
+
margin: 12px 0;
|
|
|
|
| 31 |
}
|
| 32 |
|
| 33 |
.related-events {
|
| 34 |
+
padding: 15px;
|
| 35 |
+
border-radius: 6px;
|
| 36 |
+
margin-top: 15px;
|
|
|
|
| 37 |
}
|
| 38 |
|
| 39 |
+
/* Grid and spacing utilities */
|
| 40 |
.grid {
|
| 41 |
display: grid;
|
| 42 |
}
|
|
|
|
| 65 |
margin-bottom: 0.5rem;
|
| 66 |
}
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
.text-sm {
|
| 69 |
font-size: 0.875rem;
|
| 70 |
line-height: 1.25rem;
|
| 71 |
}
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
.p-4 {
|
| 74 |
padding: 1rem;
|
| 75 |
}
|