Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -74,8 +74,17 @@ class OpenAI:
|
|
74 |
# ChatCompletion APIγγθΏγγγη΅ζγεεΎγγ
|
75 |
result = response.json()
|
76 |
print(result)
|
|
|
77 |
content = result["choices"][0]["message"]["content"].strip()
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
answers = stability_api.generate(
|
81 |
prompt=visualize_prompt,
|
|
|
74 |
# ChatCompletion APIγγθΏγγγη΅ζγεεΎγγ
|
75 |
result = response.json()
|
76 |
print(result)
|
77 |
+
|
78 |
content = result["choices"][0]["message"]["content"].strip()
|
79 |
+
|
80 |
+
split_content = content.split("### Prompt for Visual Expression\n\n")[1]
|
81 |
+
|
82 |
+
if len(split_content) > 1:
|
83 |
+
visualize_prompt = split_content[1]
|
84 |
+
else:
|
85 |
+
# Handle the case where the expected string was not found in the content
|
86 |
+
# You can either raise a custom error, log a message, or provide a default value
|
87 |
+
visualize_prompt = "Default value"
|
88 |
|
89 |
answers = stability_api.generate(
|
90 |
prompt=visualize_prompt,
|