Commit ·
6ede971
1
Parent(s): fb34a54
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,7 +70,7 @@ if st.button("Generate Presentation"):
|
|
| 70 |
query_json = {
|
| 71 |
"input_text": question,
|
| 72 |
"output_format": "json",
|
| 73 |
-
"
|
| 74 |
}
|
| 75 |
|
| 76 |
# Send the query to OpenAI
|
|
@@ -79,11 +79,15 @@ if st.button("Generate Presentation"):
|
|
| 79 |
prompt=json.dumps(query_json),
|
| 80 |
max_tokens=150,
|
| 81 |
)
|
| 82 |
-
|
| 83 |
try:
|
| 84 |
response = json.loads(completion.choices[0].text)
|
| 85 |
|
| 86 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
|
| 88 |
prs = Presentation()
|
| 89 |
|
|
|
|
| 70 |
query_json = {
|
| 71 |
"input_text": question,
|
| 72 |
"output_format": "json",
|
| 73 |
+
"max_tokens": 150,
|
| 74 |
}
|
| 75 |
|
| 76 |
# Send the query to OpenAI
|
|
|
|
| 79 |
prompt=json.dumps(query_json),
|
| 80 |
max_tokens=150,
|
| 81 |
)
|
| 82 |
+
|
| 83 |
try:
|
| 84 |
response = json.loads(completion.choices[0].text)
|
| 85 |
|
| 86 |
+
if "slides" in response:
|
| 87 |
+
slide_data = response["slides"]
|
| 88 |
+
else:
|
| 89 |
+
st.error("No slides found in the response. Please try again.")
|
| 90 |
+
st.stop()
|
| 91 |
|
| 92 |
prs = Presentation()
|
| 93 |
|