Spaces:
Running
Running
Merge pull request #12 from barun-saha/visual
Browse filesUpdate usage instructions and display of shapes
- app.py +1 -1
- global_config.py +10 -7
- helpers/pptx_helper.py +2 -1
app.py
CHANGED
|
@@ -121,7 +121,7 @@ def set_up_chat_ui():
|
|
| 121 |
"""
|
| 122 |
|
| 123 |
with st.expander('Usage Instructions'):
|
| 124 |
-
st.
|
| 125 |
st.markdown(
|
| 126 |
'SlideDeck AI is powered by'
|
| 127 |
' [Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2)'
|
|
|
|
| 121 |
"""
|
| 122 |
|
| 123 |
with st.expander('Usage Instructions'):
|
| 124 |
+
st.markdown(GlobalConfig.CHAT_USAGE_INSTRUCTIONS)
|
| 125 |
st.markdown(
|
| 126 |
'SlideDeck AI is powered by'
|
| 127 |
' [Mistral-7B-Instruct-v0.2](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2)'
|
global_config.py
CHANGED
|
@@ -46,14 +46,17 @@ class GlobalConfig:
|
|
| 46 |
# This is a long text, so not incorporated as a string in `strings.json`
|
| 47 |
CHAT_USAGE_INSTRUCTIONS = (
|
| 48 |
'Briefly describe your topic of presentation in the textbox provided below.'
|
| 49 |
-
' For example
|
| 50 |
-
'
|
| 51 |
-
' particular slide, e.g., "Make the slide with title \'Examples of AI\' a bit more'
|
| 52 |
-
' descriptive." See this [demo video](https://youtu.be/QvAKzNKtk9k).'
|
| 53 |
-
' As another example, sometimes the formatting of generated Python code can be a bit weird.'
|
| 54 |
-
' You can try it telling, "Split multi-line codes into multiple lines," and hope for a fix.'
|
| 55 |
'\n\n'
|
| 56 |
-
'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
'\n\n'
|
| 58 |
'If you like SlideDeck AI, please consider leaving a heart ❤️ on the'
|
| 59 |
' [Hugging Face Space](https://huggingface.co/spaces/barunsaha/slide-deck-ai/) or'
|
|
|
|
| 46 |
# This is a long text, so not incorporated as a string in `strings.json`
|
| 47 |
CHAT_USAGE_INSTRUCTIONS = (
|
| 48 |
'Briefly describe your topic of presentation in the textbox provided below.'
|
| 49 |
+
' For example:\n'
|
| 50 |
+
'- Make a slide deck on AI.'
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
'\n\n'
|
| 52 |
+
'Subsequently, you can add follow-up instructions, e.g.:\n'
|
| 53 |
+
'- Can you add a slide on GPUs?'
|
| 54 |
+
'\n\n'
|
| 55 |
+
' You can also ask it to refine any particular slide, e.g.:\n'
|
| 56 |
+
'- Make the slide with title \'Examples of AI\' a bit more descriptive.'
|
| 57 |
+
'\n\n'
|
| 58 |
+
'See this [demo video](https://youtu.be/QvAKzNKtk9k) for a brief walkthrough.'
|
| 59 |
+
'SlideDeck AI does not have access to the Web.'
|
| 60 |
'\n\n'
|
| 61 |
'If you like SlideDeck AI, please consider leaving a heart ❤️ on the'
|
| 62 |
' [Hugging Face Space](https://huggingface.co/spaces/barunsaha/slide-deck-ai/) or'
|
helpers/pptx_helper.py
CHANGED
|
@@ -225,7 +225,7 @@ def _handle_step_by_step_process(
|
|
| 225 |
shape = shapes.add_shape(MSO_AUTO_SHAPE_TYPE.CHEVRON, left, top, width, height)
|
| 226 |
shape.text = step.removeprefix(STEP_BY_STEP_PROCESS_MARKER)
|
| 227 |
left += width - INCHES_0_4
|
| 228 |
-
elif n_steps
|
| 229 |
# Vertical display
|
| 230 |
height = pptx.util.Inches(0.65)
|
| 231 |
width = pptx.util.Inches(slide_width_inch * 2/ 3)
|
|
@@ -239,6 +239,7 @@ def _handle_step_by_step_process(
|
|
| 239 |
left += INCHES_0_5
|
| 240 |
else:
|
| 241 |
# Two steps -- probably not a process
|
|
|
|
| 242 |
return False
|
| 243 |
|
| 244 |
return True
|
|
|
|
| 225 |
shape = shapes.add_shape(MSO_AUTO_SHAPE_TYPE.CHEVRON, left, top, width, height)
|
| 226 |
shape.text = step.removeprefix(STEP_BY_STEP_PROCESS_MARKER)
|
| 227 |
left += width - INCHES_0_4
|
| 228 |
+
elif 4 < n_steps <= 6:
|
| 229 |
# Vertical display
|
| 230 |
height = pptx.util.Inches(0.65)
|
| 231 |
width = pptx.util.Inches(slide_width_inch * 2/ 3)
|
|
|
|
| 239 |
left += INCHES_0_5
|
| 240 |
else:
|
| 241 |
# Two steps -- probably not a process
|
| 242 |
+
# More than 5--6 steps -- would likely cause a visual clutter
|
| 243 |
return False
|
| 244 |
|
| 245 |
return True
|