Spaces:
Runtime error
Runtime error
resolve ssh keys
Browse files- CodingAssistant/env_config.py +19 -0
- CodingAssistant/router.py +1 -1
- app.py +1 -14
CodingAssistant/env_config.py
CHANGED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""Config class for handling env variables.
|
2 |
+
"""
|
3 |
+
from functools import lru_cache
|
4 |
+
from pydantic import BaseSettings
|
5 |
+
|
6 |
+
class Settings(BaseSettings):
|
7 |
+
APP_ID: str
|
8 |
+
USER_ID: str
|
9 |
+
MODEL_ID: str
|
10 |
+
CLARIFAI_PAT: str
|
11 |
+
MODEL_VERSION_ID: str
|
12 |
+
|
13 |
+
class Config:
|
14 |
+
env_file = '.env'
|
15 |
+
|
16 |
+
@lru_cache()
|
17 |
+
def get_settings():
|
18 |
+
return Settings()
|
19 |
+
config = get_settings()
|
CodingAssistant/router.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from pydantic import BaseModel
|
2 |
|
3 |
-
from .
|
4 |
from fastapi.middleware.cors import CORSMiddleware
|
5 |
|
6 |
from langchain.llms import Clarifai
|
|
|
1 |
from pydantic import BaseModel
|
2 |
|
3 |
+
from .env_config import config
|
4 |
from fastapi.middleware.cors import CORSMiddleware
|
5 |
|
6 |
from langchain.llms import Clarifai
|
app.py
CHANGED
@@ -1,14 +1 @@
|
|
1 |
-
from
|
2 |
-
|
3 |
-
from fastapi import FastAPI
|
4 |
-
|
5 |
-
app = FastAPI()
|
6 |
-
|
7 |
-
|
8 |
-
@app.get("/")
|
9 |
-
async def root():
|
10 |
-
return {"message": "Hello World"}
|
11 |
-
|
12 |
-
@app.get("/items/{item_id}")
|
13 |
-
def read_item(item_id: int, q: Optional[str] = None):
|
14 |
-
return {"item_id": item_id, "q": q}
|
|
|
1 |
+
from CodingAssistant import app
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|