from fastapi import FastAPI, File, UploadFile, Request from fastapi.responses import…
- User
from fastapi import FastAPI, File, UploadFile, Request from fastapi.responses import HTMLResponse, JSONResponse, StreamingResponse import requests import time import asyncio from typing import Dict
app = FastAPI()
HTML_CONTENT = """
body::before { content: ""; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAQAAACM/9unAAAACXBIWXMAAAsTAAALEwEAmpwYAAABF0lEQVR4nO3YMRLCQBRE0clsYgxZwwq7oLGxAgp2AtbsqQZsYgEG0wEWc/LSZnb9HcMjR8fHvEKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgsK8tJOq9fzs7vlkNlWvf5ELi+20t5k2VSL7p/iHJ5Rz5ynOhU7rQ4pUi+6b4hyeUc+cpzoVO60OkV7rQ4pUi+6b4hxenu+en4rQAOkaks/eJegGaUfOHI+nRvQCND1w2J9yf8C2KZwNjkeUsAKRa7Nz50tQAokVbO/U6AaiWjl5wd6kQAOke8Xpx3JgTQKVq7Heh0ADpFvF6cd0kE0Claux3odAA6RfxenHc+BNCpWrsd6HQAOkX8Xpx3PgTQqVq7Heh0ADpF/F6cdz4E0KlarjdI/cR1FBQUGBgYGBgYGBgYG/AT4AIHph6aQGU7oAAAAASUVORK5CYII=') repeat; animation: grain 8s steps(10) infinite; opacity: 0.2; pointer-events: none; } @keyframes grain { 0% { transform: translate(0, 0); } 10% { transform: translate(-5%, -5%); } 20% { transform: translate(-10%, 5%); } 30% { transform: translate(5%, -10%); } 40% { transform: translate(-5%, 15%); } 50% { transform: translate(-10%, 5%); } 60% { transform: translate(15%, 0); } 70% { transform: translate(0, 10%); } 80% { transform: translate(-15%, 0); } 90% { transform: translate(10%, 5%); } 100% { transform: translate(5%, 0); } } .container { position: relative; width: 100%; max-width: 450px; margin: 0 auto; padding: 2rem; background: rgba(18, 18, 18, 0.9); backdrop-filter: blur(10px); border-radius: 15px; z-index: 1; text-align: center; box-shadow: 0 0 20px rgba(0, 0, 0, 0.8); } h1 { margin-bottom: 1.5rem; font-size: 1.8rem; color: #ffffff; text-shadow: 0 0 5px rgba(255, 255, 255, 0.2); } .btn { display: inline-block; position: relative; padding: 12px 24px; margin: 0.5rem; font-size: 1rem; font-weight: 600; color: #ffffff; background-color: #2a2a2a; border: none; border-radius: 5px; cursor: pointer; overflow: hidden; z-index: 1; transition: color 0.3s ease, box-shadow 0.3s ease; } .btn:hover { color: #ffffff; box-shadow: 0 0 15px rgba(200, 200, 200, 0.5); } .btn:hover::before { content: ''; position: absolute; inset: -10px; background: radial-gradient(circle at center, rgba(200,200,200,0.2), transparent); filter: blur(20px); animation: glowAnimation 2s infinite; z-index: -1; pointer-events: none; } @keyframes glowAnimation { 0% { transform: scale(0.8); } 50% { transform: scale(1.2); } 100% { transform: scale(0.8); } } .btn:active { transform: scale(0.98); } .small-btn { padding: 6px 12px; font-size: 0.8rem; font-weight: 500; background-color: #2a2a2a; color: #ffffff; border: none; border-radius: 5px; cursor: pointer; transition: color 0.3s ease, box-shadow 0.3s ease; position: relative; overflow: hidden; z-index: 1; margin: 0.25rem; } .small-btn:hover { color: #ffffff; box-shadow: 0 0 10px rgba(200, 200, 200, 0.5); } .small-btn:hover::before { content: ''; position: absolute; inset: -10px; background: radial-gradient(circle at center, rgba(200,200,200,0.2), transparent); filter: blur(15px); animation: glowAnimation 2s infinite; z-index: -1; pointer-events: none; } .small-btn:active { transform: scale(0.98); } .drop-zone { position: relative; padding: 20px; margin-bottom: 1rem; border: 2px dashed #aaa; border-radius: 10px; cursor: pointer; transition: all 0.3s ease; background: rgba(255, 255, 255, 0.05); overflow: hidden; } .drop-zone:hover, .drop-zone.drag-over { border-color: #ffffff; background: rgba(255, 255, 255, 0.1); position: relative; } .drop-zone:hover::before, .drop-zone.drag-over::before { content: ''; position: absolute; inset: -10px; background: radial-gradient(circle at center, rgba(200,200,200,0.2), transparent); filter: blur(30px); animation: grainGlow 5s infinite; z-index: -1; pointer-events: none; } @keyframes grainGlow { 0% { opacity: 0.2; } 50% { opacity: 0.5; } 100% { opacity: 0.2; } } .file-input { display: none; } .file-name { margin-top: 1rem; font-size: 0.9rem; color: #aaa; word-break: break-all; } .progress-container { display: none; margin-top: 1.5rem; } .progress-bar { width: 100%; height: 10px; background-color: #333; border-radius: 5px; overflow: hidden; margin-bottom: 10px; } .progress { width: 0%; height: 100%; background-color: #ffffff; transition: width 0.3s ease; } .loading-spinner { display: none; width: 40px; height: 40px; border: 4px solid #333; border-top: 4px solid #ffffff; border-radius: 50%; animation: spin 1s linear infinite; margin: 20px auto; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .result-container { display: none; margin-top: 1.5rem; } .result-link { color: #ffffff; text-decoration: none; font-weight: 600; transition: all 0.3s ease; margin-right: 10px; word-break: break-all; } .result-link:hover { text-decoration: underline; } .link-buttons { display: flex; justify-content: center; flex-wrap: wrap; margin-top: 10px; } /* File Types */ .file-types { margin-top: 2rem; font-size: 0.8rem; color: #aaa; } .modal { display: none; position: fixed; z-index: 2; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.8); } .modal-content { background-color: #1e1e1e; margin: 15% auto; padding: 20px; border: 1px solid #333; width: 90%; max-width: 600px; border-radius: 10px; color: #e0e0e0; animation: modalFadeIn 0.3s; position: relative; } @keyframes modalFadeIn { from {opacity: 0; transform: scale(0.8);} to {opacity: 1; transform: scale(1);} } .close { color: #aaa; position: absolute; top: 10px; right: 15px; font-size: 28px; font-weight: bold; transition: color 0.3s ease; } .close:hover, .close:focus { color: #fff; text-decoration: none; cursor: pointer; } .embed-container { display: flex; flex-direction: column; align-items: stretch; margin-top: 15px; } #embedLink { width: 100%; padding: 10px; background-color: #333; border: 1px solid #555; color: #e0e0e0; border-radius: 5px; margin-bottom: 10px; font-size: 0.9rem; } @media (max-width: 480px) { .container { padding: 1.5rem; } h1 { font-size: 1.5rem; } .btn, .small-btn { font-size: 0.9rem; padding: 10px 20px; } .file-types { font-size: 0.7rem; } .modal-content { width: 95%; margin: 10% auto; } } </style> - Assistant