dhanishetty commited on
Commit
eaed816
1 Parent(s): 1b8e6a5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -19
app.py CHANGED
@@ -1,24 +1,16 @@
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()
 
 
 
1
  from openai import OpenAI
2
+ client = OpenAI(api_key= "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")
3
 
4
+ response = client.images.generate(
5
+ model="dall-e-3",
6
+ prompt=prompt,
7
+ size="1792x1024",
8
+ quality="standard",
9
+ n=1,
10
+ )
11
 
12
+ image_url = response.data[0].url
13
+
14
+ print(image_url)
 
 
 
 
 
 
15
 
 
 
 
 
 
16