Spaces:
Sleeping
Sleeping
Commit
•
5bedc9d
1
Parent(s):
71aaff4
Update main.py
Browse files
main.py
CHANGED
@@ -5,8 +5,7 @@ from fastapi.staticfiles import StaticFiles
|
|
5 |
from fastapi.responses import FileResponse
|
6 |
from pydantic import BaseModel
|
7 |
import openai
|
8 |
-
openai.api_key = "
|
9 |
-
api_key = os.environ["apikey"]
|
10 |
|
11 |
|
12 |
app = FastAPI()
|
@@ -22,7 +21,7 @@ def chatgpt(input: ChatInput):
|
|
22 |
output = result.get('choices')[0].get('message').get('content')
|
23 |
except Exception as e:
|
24 |
output = {"output": str(e)}
|
25 |
-
return {"output": output
|
26 |
|
27 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
28 |
|
|
|
5 |
from fastapi.responses import FileResponse
|
6 |
from pydantic import BaseModel
|
7 |
import openai
|
8 |
+
openai.api_key = os.environ["apikey"]
|
|
|
9 |
|
10 |
|
11 |
app = FastAPI()
|
|
|
21 |
output = result.get('choices')[0].get('message').get('content')
|
22 |
except Exception as e:
|
23 |
output = {"output": str(e)}
|
24 |
+
return {"output": output}
|
25 |
|
26 |
app.mount("/", StaticFiles(directory="static", html=True), name="static")
|
27 |
|