Spaces:
Sleeping
Sleeping
Commit
·
1b4a9c9
1
Parent(s):
ae3712d
Changed the way the API keys are accessed
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
-
|
| 4 |
-
|
| 5 |
|
| 6 |
# Define the FastAPI app
|
| 7 |
app = FastAPI(docs_url="/")
|
|
@@ -15,7 +15,7 @@ app.add_middleware(
|
|
| 15 |
allow_headers=["*"],
|
| 16 |
)
|
| 17 |
|
| 18 |
-
key = "
|
| 19 |
|
| 20 |
|
| 21 |
@app.get("/search")
|
|
@@ -210,7 +210,7 @@ async def search(
|
|
| 210 |
images = []
|
| 211 |
|
| 212 |
# Set the OpenAI API key
|
| 213 |
-
openai.api_key = "
|
| 214 |
|
| 215 |
# Create ChatGPT query
|
| 216 |
chatgpt_response = openai.ChatCompletion.create(
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
|
| 6 |
# Define the FastAPI app
|
| 7 |
app = FastAPI(docs_url="/")
|
|
|
|
| 15 |
allow_headers=["*"],
|
| 16 |
)
|
| 17 |
|
| 18 |
+
key = os.environ.get("GOOGLE_BOOKS_API_KEY")
|
| 19 |
|
| 20 |
|
| 21 |
@app.get("/search")
|
|
|
|
| 210 |
images = []
|
| 211 |
|
| 212 |
# Set the OpenAI API key
|
| 213 |
+
openai.api_key = os.environ.get("OPENAI_API_KEY")
|
| 214 |
|
| 215 |
# Create ChatGPT query
|
| 216 |
chatgpt_response = openai.ChatCompletion.create(
|