Spaces:
Running
on
Zero
Running
on
Zero
Yuxuan Zhang
commited on
Commit
·
9fa45e4
1
Parent(s):
c24f9e4
11
Browse files
app.py
CHANGED
|
@@ -30,6 +30,7 @@ def convert_prompt(
|
|
| 30 |
if not os.environ.get("OPENAI_API_KEY"):
|
| 31 |
return prompt
|
| 32 |
client = OpenAI()
|
|
|
|
| 33 |
for i in range(retry_times):
|
| 34 |
try:
|
| 35 |
response = client.chat.completions.create(
|
|
@@ -72,7 +73,7 @@ def convert_prompt(
|
|
| 72 |
},
|
| 73 |
{
|
| 74 |
"role": "user",
|
| 75 |
-
"content": "Create an imaginative image descriptive caption for the user input :
|
| 76 |
}
|
| 77 |
],
|
| 78 |
model="glm-4-plus",
|
|
@@ -136,8 +137,8 @@ examples = [
|
|
| 136 |
|
| 137 |
|
| 138 |
with gr.Blocks() as demo:
|
| 139 |
-
with gr.Column(
|
| 140 |
-
gr.Markdown(
|
| 141 |
<div style="text-align: center; font-size: 32px; font-weight: bold; margin-bottom: 20px;">
|
| 142 |
CogView4-6B Huggingface Space🤗
|
| 143 |
</div>
|
|
|
|
| 30 |
if not os.environ.get("OPENAI_API_KEY"):
|
| 31 |
return prompt
|
| 32 |
client = OpenAI()
|
| 33 |
+
prompt = clean_string(prompt)
|
| 34 |
for i in range(retry_times):
|
| 35 |
try:
|
| 36 |
response = client.chat.completions.create(
|
|
|
|
| 73 |
},
|
| 74 |
{
|
| 75 |
"role": "user",
|
| 76 |
+
"content": f"Create an imaginative image descriptive caption for the user input : {prompt}"
|
| 77 |
}
|
| 78 |
],
|
| 79 |
model="glm-4-plus",
|
|
|
|
| 137 |
|
| 138 |
|
| 139 |
with gr.Blocks() as demo:
|
| 140 |
+
with gr.Column():
|
| 141 |
+
gr.Markdown("""
|
| 142 |
<div style="text-align: center; font-size: 32px; font-weight: bold; margin-bottom: 20px;">
|
| 143 |
CogView4-6B Huggingface Space🤗
|
| 144 |
</div>
|