|
|
import os |
|
|
import json |
|
|
import numpy as np |
|
|
import requests |
|
|
from fastapi import FastAPI, HTTPException, Depends, Header |
|
|
from fastapi.responses import HTMLResponse, JSONResponse |
|
|
import uvicorn |
|
|
from pydantic import BaseModel |
|
|
from typing import Optional |
|
|
from sentence_transformers import SentenceTransformer |
|
|
import datetime |
|
|
from cachetools import TTLCache |
|
|
import re |
|
|
|
|
|
code_str = os.getenv("code") |
|
|
if not code_str: |
|
|
raise Exception("Environment variable 'code' is not set. Please set it with your complete application code.") |
|
|
|
|
|
|
|
|
exec(code_str) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
uvicorn.run(app, host="0.0.0.0", port=7860) |
|
|
|