Spaces:
Sleeping
Sleeping
File size: 399 Bytes
ef0dbd8 869823c ef0dbd8 869823c |
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 = {"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} |