Spaces:
Sleeping
Sleeping
from fastapi import FastAPI | |
import openai | |
openai.api_key = "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" | |
app = FastAPI() | |
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} |