Commit ·
fb34a54
1
Parent(s): 742b724
Update app.py
Browse files
app.py
CHANGED
|
@@ -56,8 +56,8 @@ st.write(
|
|
| 56 |
# Input for presentation topic
|
| 57 |
presentation_title = st.text_input("Enter your presentation topic:")
|
| 58 |
no_of_pages = st.number_input("Number of slides you want", min_value=1, max_value=10, value=1) # Update max_value
|
| 59 |
-
least_c = st.number_input("Minimum points in each slide", min_value=3,
|
| 60 |
-
max_c = st.number_input("Maximum points in each slide", min_value=3,
|
| 61 |
|
| 62 |
if st.button("Generate Presentation"):
|
| 63 |
# Check if the user has entered a topic
|
|
@@ -74,13 +74,14 @@ if st.button("Generate Presentation"):
|
|
| 74 |
}
|
| 75 |
|
| 76 |
# Send the query to OpenAI
|
| 77 |
-
completion = openai.
|
| 78 |
-
|
| 79 |
-
|
|
|
|
| 80 |
)
|
| 81 |
|
| 82 |
try:
|
| 83 |
-
response = json.loads(completion.choices[0].
|
| 84 |
|
| 85 |
slide_data = response["slides"]
|
| 86 |
|
|
@@ -94,11 +95,11 @@ if st.button("Generate Presentation"):
|
|
| 94 |
slide_layout = prs.slide_layouts[1]
|
| 95 |
new_slide = prs.slides.add_slide(slide_layout)
|
| 96 |
|
| 97 |
-
if
|
| 98 |
title = new_slide.shapes.title
|
| 99 |
title.text = slide["header"]
|
| 100 |
|
| 101 |
-
if
|
| 102 |
shapes = new_slide.shapes
|
| 103 |
body_shape = shapes.placeholders[1]
|
| 104 |
tf = body_shape.text_frame
|
|
|
|
| 56 |
# Input for presentation topic
|
| 57 |
presentation_title = st.text_input("Enter your presentation topic:")
|
| 58 |
no_of_pages = st.number_input("Number of slides you want", min_value=1, max_value=10, value=1) # Update max_value
|
| 59 |
+
least_c = st.number_input("Minimum points in each slide", min_value=3, value=3) # Remove max_value
|
| 60 |
+
max_c = st.number_input("Maximum points in each slide", min_value=3, value=10) # Remove max_value
|
| 61 |
|
| 62 |
if st.button("Generate Presentation"):
|
| 63 |
# Check if the user has entered a topic
|
|
|
|
| 74 |
}
|
| 75 |
|
| 76 |
# Send the query to OpenAI
|
| 77 |
+
completion = openai.Completion.create(
|
| 78 |
+
engine="davinci",
|
| 79 |
+
prompt=json.dumps(query_json),
|
| 80 |
+
max_tokens=150,
|
| 81 |
)
|
| 82 |
|
| 83 |
try:
|
| 84 |
+
response = json.loads(completion.choices[0].text)
|
| 85 |
|
| 86 |
slide_data = response["slides"]
|
| 87 |
|
|
|
|
| 95 |
slide_layout = prs.slide_layouts[1]
|
| 96 |
new_slide = prs.slides.add_slide(slide_layout)
|
| 97 |
|
| 98 |
+
if "header" in slide:
|
| 99 |
title = new_slide.shapes.title
|
| 100 |
title.text = slide["header"]
|
| 101 |
|
| 102 |
+
if "content" in slide:
|
| 103 |
shapes = new_slide.shapes
|
| 104 |
body_shape = shapes.placeholders[1]
|
| 105 |
tf = body_shape.text_frame
|