File size: 368 Bytes
ef0dbd8
6b50289
 
ef0dbd8
 
 
 
 
6b50289
 
 
1
2
3
4
5
6
7
8
9
10
11
from fastapi import FastAPI
import openai
openai.api_key = "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"

app = FastAPI()

@app.get("/")
def read_root():
    input = "Translate this sentence to French. Sentence: I can speak Chinese."
    output = openai.Completion.create(model="gpt-3.5-turbo", prompt="Translate")
    return {"Input": input, "Output": output}