coolai / main.py
TintinMeimei's picture
Update main.py
869823c
raw
history blame
399 Bytes
from fastapi import FastAPI
import openai
openai.api_key = "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"
app = FastAPI()
@app.get("/")
def read_root():
input = {"role": "user", "content": "Translate this sentence to French. Sentence: I can speak Chinese."}
output = openai.ChatCompletion.create(model="gpt-3.5-turbo", messages=[input])
return {"Input": input, "Output": output}