Spaces:
Runtime error
Runtime error
anteaterho
commited on
Commit
β’
c7bd072
1
Parent(s):
0501d0a
remove openai module
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import gradio as gr
|
2 |
-
import openai
|
3 |
import re
|
4 |
import datetime
|
5 |
|
@@ -11,8 +10,6 @@ import random
|
|
11 |
|
12 |
# token for SDXL
|
13 |
access_token="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"
|
14 |
-
# token for OpenAI
|
15 |
-
openai.api_key = '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'
|
16 |
|
17 |
# output path
|
18 |
path = "./output"
|
@@ -23,28 +20,6 @@ messages=[{
|
|
23 |
'content' : 'You are a helpful assistant for organizing prompt for generating images'
|
24 |
}]
|
25 |
|
26 |
-
def translate(msg):
|
27 |
-
messages.append({
|
28 |
-
'role' : 'assistant',
|
29 |
-
'content' : msg
|
30 |
-
})
|
31 |
-
|
32 |
-
messages.append({
|
33 |
-
'role' : 'user',
|
34 |
-
'content' : 'Translate the sentence into English only. Keep the symbols intact when translating.'
|
35 |
-
})
|
36 |
-
|
37 |
-
res = openai.ChatCompletion.create(
|
38 |
-
model='gpt-3.5-turbo',
|
39 |
-
messages=messages
|
40 |
-
)
|
41 |
-
|
42 |
-
_msg = res['choices'][0]['message']['content']
|
43 |
-
|
44 |
-
print(_msg)
|
45 |
-
|
46 |
-
return _msg
|
47 |
-
|
48 |
# mBart settings
|
49 |
article_kr = "μ μμ λνλ μ리μμ κ΅°μ¬μ μΈ ν΄κ²°μ±
μ΄ μλ€κ³ λ§ν©λλ€." #example article
|
50 |
|
|
|
1 |
import gradio as gr
|
|
|
2 |
import re
|
3 |
import datetime
|
4 |
|
|
|
10 |
|
11 |
# token for SDXL
|
12 |
access_token="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"
|
|
|
|
|
13 |
|
14 |
# output path
|
15 |
path = "./output"
|
|
|
20 |
'content' : 'You are a helpful assistant for organizing prompt for generating images'
|
21 |
}]
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
# mBart settings
|
24 |
article_kr = "μ μμ λνλ μ리μμ κ΅°μ¬μ μΈ ν΄κ²°μ±
μ΄ μλ€κ³ λ§ν©λλ€." #example article
|
25 |
|