Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from openai import OpenAI
|
| 3 |
|
| 4 |
client = OpenAI(api_key="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")
|
| 5 |
|
| 6 |
def get_completion(prompt, model="ft:gpt-3.5-turbo-0613:personal::8fjNPFEp"):
|
| 7 |
-
messages = [{"role": "system", "content": "you are an
|
| 8 |
|
| 9 |
response = client.chat.completions.create(
|
| 10 |
model=model,
|
| 11 |
messages=messages,
|
| 12 |
temperature=0
|
| 13 |
)
|
| 14 |
-
return response
|
| 15 |
-
|
| 16 |
|
| 17 |
title = "Enter your Prompt"
|
| 18 |
description = """
|
| 19 |
-
This is fine
|
| 20 |
<img src = "https://upload.wikimedia.org/wikipedia/commons/4/4d/OpenAI_Logo.svg" width=300px>
|
| 21 |
"""
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
if __name__ == "__main__":
|
| 27 |
-
demo.launch()
|
|
|
|
| 1 |
+
import openai
|
| 2 |
import gradio as gr
|
| 3 |
from openai import OpenAI
|
| 4 |
|
| 5 |
client = OpenAI(api_key="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")
|
| 6 |
|
| 7 |
def get_completion(prompt, model="ft:gpt-3.5-turbo-0613:personal::8fjNPFEp"):
|
| 8 |
+
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}]
|
| 9 |
|
| 10 |
response = client.chat.completions.create(
|
| 11 |
model=model,
|
| 12 |
messages=messages,
|
| 13 |
temperature=0
|
| 14 |
)
|
| 15 |
+
return response.choices[0].message.content
|
|
|
|
| 16 |
|
| 17 |
title = "Enter your Prompt"
|
| 18 |
description = """
|
| 19 |
+
This is fine-tuned model. Which helps in learning english
|
| 20 |
<img src = "https://upload.wikimedia.org/wikipedia/commons/4/4d/OpenAI_Logo.svg" width=300px>
|
| 21 |
"""
|
| 22 |
|
| 23 |
+
gr.Interface(fn=get_completion, inputs="text", outputs="text",title=title, description=description
|
| 24 |
+
).launch()
|
|
|
|
|
|
|
|
|