Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -262,57 +262,9 @@ if not os.path.exists("static"):
|
|
| 262 |
os.makedirs("static")
|
| 263 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 264 |
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
async def read_root():
|
| 269 |
-
return """
|
| 270 |
-
<!DOCTYPE html>
|
| 271 |
-
<html>
|
| 272 |
-
<head>
|
| 273 |
-
<title>InfinityGRM Engine</title>
|
| 274 |
-
<style>
|
| 275 |
-
body { font-family: sans-serif; display: flex; justify-content: center; align-items: center; height: 100vh; background: #fafafa; margin: 0; }
|
| 276 |
-
.card { background: white; padding: 30px; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); width: 400px; text-align: center; }
|
| 277 |
-
input { width: 100%; padding: 12px; margin: 15px 0; border: 1px solid #ddd; border-radius: 6px; box-sizing: border-box; font-size: 16px; }
|
| 278 |
-
button { background: #2563eb; color: white; border: none; padding: 12px 24px; border-radius: 6px; cursor: pointer; font-size: 16px; width: 100%; }
|
| 279 |
-
button:hover { background: #1d4ed8; }
|
| 280 |
-
#output { margin-top: 20px; font-weight: bold; color: #333; min-height: 24px; }
|
| 281 |
-
</style>
|
| 282 |
-
</head>
|
| 283 |
-
<body>
|
| 284 |
-
<div class="card">
|
| 285 |
-
<h2>InfinityGRM Engine</h2>
|
| 286 |
-
<p>Enter your text query below:</p>
|
| 287 |
-
<input type="text" id="userInput" placeholder="Type your message here (e.g., hi)...">
|
| 288 |
-
<button onclick="sendQuery()">Submit Query</button>
|
| 289 |
-
<div id="output"></div>
|
| 290 |
-
</div>
|
| 291 |
-
|
| 292 |
-
<script>
|
| 293 |
-
async function sendQuery() {
|
| 294 |
-
const inputVal = document.getElementById('userInput').value;
|
| 295 |
-
const outDiv = document.getElementById('output');
|
| 296 |
-
if(!inputVal) return;
|
| 297 |
-
|
| 298 |
-
outDiv.innerText = "Processing...";
|
| 299 |
-
|
| 300 |
-
try {
|
| 301 |
-
// Adjust the route path ('/predict') to match your model inference POST route name
|
| 302 |
-
const response = await fetch('/predict', {
|
| 303 |
-
method: 'POST',
|
| 304 |
-
headers: { 'Content-Type': 'application/json' },
|
| 305 |
-
body: JSON.stringify({ text: inputVal })
|
| 306 |
-
});
|
| 307 |
-
const data = await response.json();
|
| 308 |
-
outDiv.innerText = data.result || JSON.stringify(data);
|
| 309 |
-
} catch (err) {
|
| 310 |
-
outDiv.innerText = "Error contacting model engine.";
|
| 311 |
-
}
|
| 312 |
-
}
|
| 313 |
-
</script>
|
| 314 |
-
</body>
|
| 315 |
-
</html>
|
| 316 |
|
| 317 |
# --- HUGGING FACE DOCKER PORT BINDING ---
|
| 318 |
if __name__ == "__main__":
|
|
|
|
| 262 |
os.makedirs("static")
|
| 263 |
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 264 |
|
| 265 |
+
@app.get("/")
|
| 266 |
+
async def home_route_processor():
|
| 267 |
+
return {"message": "Infinity GRM Engine Core is active."}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
|
| 269 |
# --- HUGGING FACE DOCKER PORT BINDING ---
|
| 270 |
if __name__ == "__main__":
|