Prathamesh Sarjerao Vaidya
commited on
Commit
·
0d2733f
1
Parent(s):
9718a7d
made some changes
Browse files- templates/index.html +23 -10
- web_app.py +39 -13
templates/index.html
CHANGED
|
@@ -269,7 +269,6 @@
|
|
| 269 |
<p class="text-sm text-gray-500 mt-1">Audio message about website communication enhancement</p>
|
| 270 |
<div class="flex items-center mt-2">
|
| 271 |
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800">Japanese</span>
|
| 272 |
-
<span class="ml-2 text-xs text-gray-500">~23 seconds</span>
|
| 273 |
</div>
|
| 274 |
</div>
|
| 275 |
</div>
|
|
@@ -285,7 +284,6 @@
|
|
| 285 |
<p class="text-sm text-gray-500 mt-1">Discussion about recent movies including Social Network</p>
|
| 286 |
<div class="flex items-center mt-2">
|
| 287 |
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">French</span>
|
| 288 |
-
<span class="ml-2 text-xs text-gray-500">~25 seconds</span>
|
| 289 |
</div>
|
| 290 |
</div>
|
| 291 |
</div>
|
|
@@ -456,8 +454,8 @@
|
|
| 456 |
<div id="system-info-content">
|
| 457 |
<div class="loading text-center py-4">
|
| 458 |
<i class="fas fa-spinner text-2xl text-blue-500"></i>
|
| 459 |
-
<p class="mt-2 text-gray-600">Loading system information...</p>
|
| 460 |
</div>
|
|
|
|
| 461 |
</div>
|
| 462 |
</div>
|
| 463 |
</div>
|
|
@@ -1127,18 +1125,34 @@
|
|
| 1127 |
// System info modal
|
| 1128 |
systemInfoBtn.addEventListener('click', async () => {
|
| 1129 |
systemInfoModal.classList.remove('hidden');
|
| 1130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1131 |
try {
|
| 1132 |
const response = await fetch('/api/system-info');
|
| 1133 |
const info = await response.json();
|
| 1134 |
-
|
| 1135 |
-
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1136 |
content.innerHTML = `
|
| 1137 |
<div class="space-y-3">
|
| 1138 |
<div>
|
| 1139 |
<span class="font-medium">Status:</span>
|
| 1140 |
-
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium
|
| 1141 |
-
${info.status}
|
| 1142 |
</span>
|
| 1143 |
</div>
|
| 1144 |
<div>
|
|
@@ -1156,8 +1170,7 @@
|
|
| 1156 |
</div>
|
| 1157 |
`;
|
| 1158 |
} catch (error) {
|
| 1159 |
-
|
| 1160 |
-
'<p class="text-red-600">Error loading system information</p>';
|
| 1161 |
}
|
| 1162 |
});
|
| 1163 |
|
|
|
|
| 269 |
<p class="text-sm text-gray-500 mt-1">Audio message about website communication enhancement</p>
|
| 270 |
<div class="flex items-center mt-2">
|
| 271 |
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-blue-100 text-blue-800">Japanese</span>
|
|
|
|
| 272 |
</div>
|
| 273 |
</div>
|
| 274 |
</div>
|
|
|
|
| 284 |
<p class="text-sm text-gray-500 mt-1">Discussion about recent movies including Social Network</p>
|
| 285 |
<div class="flex items-center mt-2">
|
| 286 |
<span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-green-800">French</span>
|
|
|
|
| 287 |
</div>
|
| 288 |
</div>
|
| 289 |
</div>
|
|
|
|
| 454 |
<div id="system-info-content">
|
| 455 |
<div class="loading text-center py-4">
|
| 456 |
<i class="fas fa-spinner text-2xl text-blue-500"></i>
|
|
|
|
| 457 |
</div>
|
| 458 |
+
<p class="mt-2 text-gray-600">Loading system information...</p>
|
| 459 |
</div>
|
| 460 |
</div>
|
| 461 |
</div>
|
|
|
|
| 1125 |
// System info modal
|
| 1126 |
systemInfoBtn.addEventListener('click', async () => {
|
| 1127 |
systemInfoModal.classList.remove('hidden');
|
| 1128 |
+
|
| 1129 |
+
const content = document.getElementById('system-info-content');
|
| 1130 |
+
content.innerHTML = `
|
| 1131 |
+
<div class="loading text-center py-4">
|
| 1132 |
+
<i class="fas fa-spinner text-2xl text-blue-500 animate-spin"></i>
|
| 1133 |
+
<p class="mt-2 text-gray-600">Loading system information...</p>
|
| 1134 |
+
</div>
|
| 1135 |
+
`;
|
| 1136 |
+
|
| 1137 |
try {
|
| 1138 |
const response = await fetch('/api/system-info');
|
| 1139 |
const info = await response.json();
|
| 1140 |
+
|
| 1141 |
+
const statusColors = {
|
| 1142 |
+
green: "bg-green-100 text-green-800",
|
| 1143 |
+
yellow: "bg-yellow-100 text-yellow-800",
|
| 1144 |
+
red: "bg-red-100 text-red-800",
|
| 1145 |
+
gray: "bg-gray-100 text-gray-800"
|
| 1146 |
+
};
|
| 1147 |
+
|
| 1148 |
+
const colorClass = statusColors[info.statusColor] || statusColors.gray;
|
| 1149 |
+
|
| 1150 |
content.innerHTML = `
|
| 1151 |
<div class="space-y-3">
|
| 1152 |
<div>
|
| 1153 |
<span class="font-medium">Status:</span>
|
| 1154 |
+
<span class="ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${colorClass}">
|
| 1155 |
+
⬤ ${info.status}
|
| 1156 |
</span>
|
| 1157 |
</div>
|
| 1158 |
<div>
|
|
|
|
| 1170 |
</div>
|
| 1171 |
`;
|
| 1172 |
} catch (error) {
|
| 1173 |
+
content.innerHTML = `<p class="text-red-600">Error loading system information</p>`;
|
|
|
|
| 1174 |
}
|
| 1175 |
});
|
| 1176 |
|
web_app.py
CHANGED
|
@@ -824,21 +824,47 @@ def format_srt_time(seconds: float) -> str:
|
|
| 824 |
@app.get("/api/system-info")
|
| 825 |
async def get_system_info():
|
| 826 |
"""Get system information."""
|
| 827 |
-
info = {
|
| 828 |
-
"status": "operational",
|
| 829 |
-
"version": "1.0.0",
|
| 830 |
-
"features": [
|
| 831 |
-
"Speaker Diarization",
|
| 832 |
-
"Speech Recognition",
|
| 833 |
-
"Neural Translation",
|
| 834 |
-
"Interactive Visualization"
|
| 835 |
-
]
|
| 836 |
-
}
|
| 837 |
|
| 838 |
if UTILS_AVAILABLE:
|
| 839 |
try:
|
| 840 |
-
|
| 841 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 842 |
except Exception as e:
|
| 843 |
logger.error(f"Failed to get system info: {e}")
|
| 844 |
|
|
@@ -920,4 +946,4 @@ if __name__ == "__main__":
|
|
| 920 |
port=8000,
|
| 921 |
reload=True,
|
| 922 |
log_level="info"
|
| 923 |
-
)
|
|
|
|
| 824 |
@app.get("/api/system-info")
|
| 825 |
async def get_system_info():
|
| 826 |
"""Get system information."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 827 |
|
| 828 |
if UTILS_AVAILABLE:
|
| 829 |
try:
|
| 830 |
+
# from utils import _collect_system_info # or import as needed
|
| 831 |
+
# sys_info = _collect_system_info()
|
| 832 |
+
# sys_info = get_system_info()
|
| 833 |
+
# info.update(sys_info)
|
| 834 |
+
|
| 835 |
+
info = {
|
| 836 |
+
"version": "1.0.0",
|
| 837 |
+
"features": [
|
| 838 |
+
"Speaker Diarization",
|
| 839 |
+
"Speech Recognition",
|
| 840 |
+
"Neural Translation",
|
| 841 |
+
"Interactive Visualization"
|
| 842 |
+
]
|
| 843 |
+
}
|
| 844 |
+
|
| 845 |
+
# Perform the health check
|
| 846 |
+
health_status = "Unknown"
|
| 847 |
+
health_color = "gray"
|
| 848 |
+
|
| 849 |
+
try:
|
| 850 |
+
from fastapi.testclient import TestClient
|
| 851 |
+
client = TestClient(app)
|
| 852 |
+
res = client.get("/health")
|
| 853 |
+
|
| 854 |
+
if res.status_code == 200 and res.json().get("status") == "ok":
|
| 855 |
+
health_status = "Live"
|
| 856 |
+
health_color = "green"
|
| 857 |
+
else:
|
| 858 |
+
health_status = "Error"
|
| 859 |
+
health_color = "yellow"
|
| 860 |
+
except Exception:
|
| 861 |
+
health_status = "Server Down"
|
| 862 |
+
health_color = "red"
|
| 863 |
+
|
| 864 |
+
info["status"] = health_status
|
| 865 |
+
info["statusColor"] = health_color
|
| 866 |
+
|
| 867 |
+
|
| 868 |
except Exception as e:
|
| 869 |
logger.error(f"Failed to get system info: {e}")
|
| 870 |
|
|
|
|
| 946 |
port=8000,
|
| 947 |
reload=True,
|
| 948 |
log_level="info"
|
| 949 |
+
)
|