usmanyousaf commited on
Commit
706c139
·
verified ·
1 Parent(s): 1387336

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +26 -28
app.py CHANGED
@@ -104,9 +104,7 @@ def build_ui():
104
 
105
  st.title(APP_TEXT['app_name'])
106
  st.subheader(APP_TEXT['caption'])
107
- st.markdown(
108
- '![Visitors](https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fhuggingface.co%2Fspaces%2Fbarunsaha%2Fslide-deck-ai&countColor=%23263759)' # noqa: E501
109
- )
110
 
111
  with st.expander('Usage Policies and Limitations'):
112
  st.text(APP_TEXT['tos'] + '\n\n' + APP_TEXT['tos2'])
@@ -118,28 +116,33 @@ def set_up_chat_ui():
118
  """
119
  Prepare the chat interface and related functionality.
120
  """
121
-
122
  with st.expander('Usage Instructions'):
123
  st.markdown(GlobalConfig.CHAT_USAGE_INSTRUCTIONS)
124
  st.markdown(
125
- '[SlideDeck AI](https://github.com/barun-saha/slide-deck-ai) is an Open-Source project.' # noqa: E501
126
- ' It is is powered by' # noqa: E501
127
- ' [Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407).' # noqa: E501
 
 
 
 
 
 
128
  )
129
 
130
- st.info(
131
- 'If you like SlideDeck AI, please consider leaving a heart ❤️ on the'
132
- ' [Hugging Face Space](https://huggingface.co/spaces/barunsaha/slide-deck-ai/) or'
133
- ' a star ⭐ on [GitHub](https://github.com/barun-saha/slide-deck-ai).'
134
- ' Your [feedback](https://forms.gle/JECFBGhjvSj7moBx9) is appreciated.'
135
- )
136
-
137
- # view_messages = st.expander('View the messages in the session state')
 
138
 
139
  st.chat_message('ai').write(
140
  random.choice(APP_TEXT['ai_greetings'])
141
  )
142
-
143
  history = StreamlitChatMessageHistory(key=CHAT_MESSAGES)
144
 
145
  if _is_it_refinement():
@@ -240,10 +243,8 @@ def set_up_chat_ui():
240
  history.add_ai_message(response)
241
 
242
  # The content has been generated as JSON
243
- # There maybe trailing
244
- at the end of the response -- remove them
245
- # To be careful:
246
- may be part of the content as well when code is generated
247
  response_cleaned = text_helper.get_clean_json(response)
248
 
249
  logger.info(
@@ -277,7 +278,7 @@ def generate_slide_deck(json_str: str) -> Union[pathlib.Path, None]:
277
  deck, the path may be to an empty file.
278
 
279
  :param json_str: The content in *valid* JSON format.
280
- :return: The path to the .pptx file or None in case of error.
281
  """
282
 
283
  try:
@@ -305,16 +306,16 @@ def generate_slide_deck(json_str: str) -> Union[pathlib.Path, None]:
305
  except RecursionError:
306
  st.error(
307
  'Encountered an error while parsing JSON...'
308
- 'the slide deck cannot be created, unfortunately ☹'
309
  '\nPlease try again later.'
310
  )
311
- logger.error('Caught RecursionError while parsing JSON. Cannot generate the slide deck!')
312
 
313
  return None
314
  except Exception:
315
  st.error(
316
  'Encountered an error while parsing JSON...'
317
- 'the slide deck cannot be created, unfortunately ☹'
318
  '\nPlease try again later.'
319
  )
320
  logger.error(
@@ -424,7 +425,4 @@ def main():
424
 
425
  if __name__ == '__main__':
426
  main()
427
-
428
-
429
-
430
-
 
104
 
105
  st.title(APP_TEXT['app_name'])
106
  st.subheader(APP_TEXT['caption'])
107
+
 
 
108
 
109
  with st.expander('Usage Policies and Limitations'):
110
  st.text(APP_TEXT['tos'] + '\n\n' + APP_TEXT['tos2'])
 
116
  """
117
  Prepare the chat interface and related functionality.
118
  """
 
119
  with st.expander('Usage Instructions'):
120
  st.markdown(GlobalConfig.CHAT_USAGE_INSTRUCTIONS)
121
  st.markdown(
122
+ '**AI SlideMaker** is our FYP project (Module 1) under the supervision of Maam Fouzia. '
123
+ 'It is powered by [Mistral-Nemo-Instruct-2407](https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407). '
124
+ 'Group members: Usman Yousaf, Faisal Nawaz Khan, Mahnoor Asghar.'
125
+ )
126
+ st.info(
127
+ 'As this is an academic project, we are limited in the time we can dedicate to development. '
128
+ 'However, we are committed to enhancing **AI SlideMaker** over time, adding more features and improvements based on your suggestions. '
129
+ 'Your support means a lot to us—please consider leaving a heart ❤️ and sharing your feedback. '
130
+ 'Every bit of encouragement helps us make this tool as useful as possible for the public!'
131
  )
132
 
133
+ # Feedback Section
134
+ with st.expander('Leave Your Feedback'):
135
+ feedback = st.text_area("We would love to hear your thoughts! Please share your feedback or suggestions below:")
136
+ if st.button("Submit Feedback"):
137
+ # Here, you can implement the logic to handle feedback submission
138
+ st.success("Thank you for your feedback! We appreciate your support.")
139
+ # Optionally, save feedback to a file or a database
140
+ with open("feedback.txt", "a") as f:
141
+ f.write(feedback + "\n")
142
 
143
  st.chat_message('ai').write(
144
  random.choice(APP_TEXT['ai_greetings'])
145
  )
 
146
  history = StreamlitChatMessageHistory(key=CHAT_MESSAGES)
147
 
148
  if _is_it_refinement():
 
243
  history.add_ai_message(response)
244
 
245
  # The content has been generated as JSON
246
+ # There maybe trailing ``` at the end of the response -- remove them
247
+ # To be careful: ``` may be part of the content as well when code is generated
 
 
248
  response_cleaned = text_helper.get_clean_json(response)
249
 
250
  logger.info(
 
278
  deck, the path may be to an empty file.
279
 
280
  :param json_str: The content in *valid* JSON format.
281
+ :return: The path to the .pptx file or `None` in case of error.
282
  """
283
 
284
  try:
 
306
  except RecursionError:
307
  st.error(
308
  'Encountered an error while parsing JSON...'
309
+ 'the slide cannot be created, unfortunately ☹'
310
  '\nPlease try again later.'
311
  )
312
+ logger.error('Caught RecursionError while parsing JSON. Cannot generate the slidemaker!')
313
 
314
  return None
315
  except Exception:
316
  st.error(
317
  'Encountered an error while parsing JSON...'
318
+ 'the slide cannot be created, unfortunately ☹'
319
  '\nPlease try again later.'
320
  )
321
  logger.error(
 
425
 
426
  if __name__ == '__main__':
427
  main()
428
+