Spaces:
Runtime error
Runtime error
File size: 659 Bytes
64f613e bbbae7e 64f613e bbbae7e 64f613e bbbae7e 64f613e bbbae7e 64f613e bbbae7e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import gradio as gr
import openai
import os
openai.api_key = os.getenv("OPENAI_API_KEY")
def trans(word):
msg = "λ€μμ€μ ν
μ€νΈμ λν΄μ νκΈμ μμ΄λ‘, μμ΄λ νκΈλ‘ λ²μν΄μ€. \n" + word
print(msg)
chat_completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo", messages=[{"role": "user", "content": msg}]
)
result = chat_completion["choices"][0]["message"]["content"]
return result
app = gr.Interface(
fn=trans,
inputs=[
gr.Textbox(),
],
outputs="text",
examples=[["ko2en", "μ¬λ"], ["en2ko", "love"]],
allow_flagging="manual",
)
app.launch(debug=True) |