Spaces:
Sleeping
Sleeping
TintinMeimei
commited on
Commit
•
6b50289
1
Parent(s):
e737891
Update main.py
Browse files
main.py
CHANGED
@@ -1,7 +1,11 @@
|
|
1 |
from fastapi import FastAPI
|
|
|
|
|
2 |
|
3 |
app = FastAPI()
|
4 |
|
5 |
@app.get("/")
|
6 |
def read_root():
|
7 |
-
|
|
|
|
|
|
1 |
from fastapi import FastAPI
|
2 |
+
import openai
|
3 |
+
openai.api_key = "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"
|
4 |
|
5 |
app = FastAPI()
|
6 |
|
7 |
@app.get("/")
|
8 |
def read_root():
|
9 |
+
input = "Translate this sentence to French. Sentence: I can speak Chinese."
|
10 |
+
output = openai.Completion.create(model="gpt-3.5-turbo", prompt="Translate")
|
11 |
+
return {"Input": input, "Output": output}
|