dhanishetty's picture
Update app.py
1b8e6a5 verified
raw
history blame
928 Bytes
import openai
import gradio as gr
from openai import OpenAI
client = OpenAI(api_key="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")
def get_completion(prompt, model="ft:gpt-3.5-turbo-0613:personal::8fjNPFEp"):
messages = [{"role": "system", "content": "you are an English teaching chatbot who replies everything in both English and Korean. but each line should be in English and Korean."}, {"role": "user", "content": prompt}]
response = client.chat.completions.create(
model=model,
messages=messages,
temperature=0
)
return response.choices[0].message.content
title = "Enter your Prompt"
description = """
This is fine-tuned model. Which helps in learning english
<img src = "https://upload.wikimedia.org/wikipedia/commons/4/4d/OpenAI_Logo.svg" width=300px>
"""
gr.Interface(fn=get_completion, inputs="text", outputs="text",title=title, description=description
).launch()