ochyai commited on
Commit
08f93b8
β€’
1 Parent(s): d749765

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
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
- visualize_prompt = content.split("### Prompt for Visual Expression\n\n")[1]
 
 
 
 
 
 
 
 
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,