dhanishetty commited on
Commit
ab9f15c
·
verified ·
1 Parent(s): efb25ff

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -18
app.py CHANGED
@@ -1,27 +1,27 @@
1
- import openai
2
  import gradio as gr
3
-
4
  from openai import OpenAI
5
- client = OpenAI(api_key= "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")
6
-
7
 
8
- title = "dall-e image generation"
9
- description = "provide prompt to generate an image"
10
 
 
 
 
 
 
 
 
 
 
11
 
12
 
13
- def get_image(prompt ):
14
- response = client.images.generate(
15
- model="dall-e-3",
16
- prompt= prompt,
17
- size="1792x1024",
18
- quality="standard",
19
- n=1,
20
- )
21
-
22
 
23
 
 
24
 
25
- demo = gr.Interface(fn=get_image,
26
- inputs = [gr.Textbox(label="Enter the Prompt")],
27
- outputs = gr.Image(type='pil'), title = title, description = description).launch(debug='True')
 
 
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 english teaching chatbot who replies everything in both english and korean. but each line should be in english and korean."}, {"role": "user", "content": prompt}]
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 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
 
24
+ demo = gr.ChatInterface(fn=get_completion, title=title, description=description ).queue()
25
 
26
+ if __name__ == "__main__":
27
+ demo.launch()