bertugmirasyedi commited on
Commit
1b4a9c9
1 Parent(s): ae3712d

Changed the way the API keys are accessed

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -1,7 +1,7 @@
1
  from fastapi import FastAPI
2
  from fastapi.middleware.cors import CORSMiddleware
3
- from fastapi.responses import StreamingResponse
4
- from fastapi.encoders import jsonable_encoder
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 = "AIzaSyCEiSxvAfXHAXNE2Q5b95vBpwjlbjl5GO8"
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 = "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"
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(