TintinMeimei commited on
Commit
c2c7360
1 Parent(s): c8f0cab

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -5,9 +5,9 @@ from fastapi.staticfiles import StaticFiles
5
  from fastapi.responses import FileResponse
6
  from pydantic import BaseModel
7
  import openai
8
- #openai.api_key = "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"
9
  api_key = os.environ.getattribute("apikey")
10
- print(api_key)
11
 
12
  app = FastAPI()
13
  class ChatInput(BaseModel):
@@ -22,7 +22,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 = "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"
9
  api_key = os.environ.getattribute("apikey")
10
+
11
 
12
  app = FastAPI()
13
  class ChatInput(BaseModel):
 
22
  output = result.get('choices')[0].get('message').get('content')
23
  except Exception as e:
24
  output = {"output": str(e)}
25
+ return {"output": output + str(api_key)}
26
 
27
  app.mount("/", StaticFiles(directory="static", html=True), name="static")
28