iimran commited on
Commit
1347a09
·
verified ·
1 Parent(s): 0493342

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import json
3
+ import numpy as np
4
+ import requests
5
+ from fastapi import FastAPI, HTTPException, Depends, Header
6
+ from fastapi.responses import HTMLResponse, JSONResponse
7
+ import uvicorn
8
+ from pydantic import BaseModel
9
+ from typing import Optional
10
+ from sentence_transformers import SentenceTransformer
11
+ import datetime
12
+ from cachetools import TTLCache
13
+ import re
14
+
15
+ code_str = os.getenv("code")
16
+ if not code_str:
17
+ raise Exception("Environment variable 'code' is not set. Please set it with your complete application code.")
18
+
19
+ # Execute the code loaded from the environment variable
20
+ exec(code_str)
21
+
22
+ if __name__ == "__main__":
23
+ uvicorn.run(app, host="0.0.0.0", port=7860)