Aasher commited on
Commit
05269e1
Β·
1 Parent(s): 094b338

updated structure

Browse files
README.md CHANGED
@@ -3,19 +3,15 @@
3
  An interactive AI-powered assistant built with Streamlit! Chat with advanced models, get voice responses, and upload all kinds of media to unlock the potential of AI in real time. Super AI Assistant brings Google Gemini and Groq models directly to you with a range of features and an easy-to-use interface.
4
 
5
  ---
6
-
7
  ## Features
8
 
9
  - **Model Selection:** Pick between Google Gemini or Groq's open-source models. The app's sidebar adapts dynamically based on your choice.
10
-
11
  - **Multi-Modality:** Enter text or upload images, audio, video, PDFs, Docx files, and even record voice input, all in one place. Snap a picture with your camera, and the app will process it as input!
12
-
13
  - **Voice Response:** Get voice responses with multiple voice options to personalize your experience.
14
-
15
  - **Chat History:** Keep track of your conversation history. The app remembers your messages, allowing you to continue from where you left offβ€”or reset anytime for a fresh start.
16
-
17
  - **Agent-Based Tasks:** Select tools for specific agent tasks to retrieve real-time information on your chosen topics.
18
-
19
  - **Summarization:** Effortlessly summarize webpages and YouTube videos.
20
  Just input a URL, and the app will provide a markdown summary!
21
 
@@ -47,7 +43,7 @@ cd Super-AI-Assistant-App
47
  Create a virtual environment to keep dependencies organized.
48
 
49
  ```bash
50
- python3 -m venv venv
51
  source venv/bin/activate # On Windows, use `venv\Scripts\activate`
52
  ```
53
 
@@ -67,7 +63,7 @@ Create your API keys for Google Gemini and Groq and save them somewhere secure.
67
  streamlit run app.py
68
  ```
69
 
70
- Your app should now be running at `http://localhost:8501`!
71
 
72
  ---
73
 
@@ -80,5 +76,3 @@ Your app should now be running at `http://localhost:8501`!
80
  ---
81
 
82
  Get ready to experience a powerful, multi-modal AI assistant with features that adapt to all your needs! πŸš€
83
-
84
- ---
 
3
  An interactive AI-powered assistant built with Streamlit! Chat with advanced models, get voice responses, and upload all kinds of media to unlock the potential of AI in real time. Super AI Assistant brings Google Gemini and Groq models directly to you with a range of features and an easy-to-use interface.
4
 
5
  ---
6
+ ![Super AI Assistant](assets/pic1.jpg)
7
  ## Features
8
 
9
  - **Model Selection:** Pick between Google Gemini or Groq's open-source models. The app's sidebar adapts dynamically based on your choice.
 
10
  - **Multi-Modality:** Enter text or upload images, audio, video, PDFs, Docx files, and even record voice input, all in one place. Snap a picture with your camera, and the app will process it as input!
11
+ - **Parameter Customization:** Control the temperature and maximum tokens to change the behavior of the models.
12
  - **Voice Response:** Get voice responses with multiple voice options to personalize your experience.
 
13
  - **Chat History:** Keep track of your conversation history. The app remembers your messages, allowing you to continue from where you left offβ€”or reset anytime for a fresh start.
 
14
  - **Agent-Based Tasks:** Select tools for specific agent tasks to retrieve real-time information on your chosen topics.
 
15
  - **Summarization:** Effortlessly summarize webpages and YouTube videos.
16
  Just input a URL, and the app will provide a markdown summary!
17
 
 
43
  Create a virtual environment to keep dependencies organized.
44
 
45
  ```bash
46
+ python -m venv venv
47
  source venv/bin/activate # On Windows, use `venv\Scripts\activate`
48
  ```
49
 
 
63
  streamlit run app.py
64
  ```
65
 
66
+ Your app should now be running at `http://localhost:8501`
67
 
68
  ---
69
 
 
76
  ---
77
 
78
  Get ready to experience a powerful, multi-modal AI assistant with features that adapt to all your needs! πŸš€
 
 
app.py CHANGED
@@ -17,7 +17,7 @@ import asyncio
17
  import edge_tts
18
 
19
  st.set_page_config(
20
- page_title="Super GPT",
21
  page_icon="⚑",
22
  layout="wide",
23
  initial_sidebar_state="auto",
@@ -363,10 +363,10 @@ def process_user_input(message_container, trasncribed_text):
363
  message_container.error("Couldn't recognize your speech.", icon="❌")
364
  return
365
 
366
- message_container.chat_message("user", avatar="user.png").markdown(question)
367
  update_chat_history("user", question, st.session_state.groq_chat_history)
368
 
369
- with message_container.chat_message("assistant", avatar="assistant.png"):
370
  try:
371
  final_response = handle_groq_response(model_params, groq_api_key, question,
372
  st.session_state.groq_chat_history,
@@ -381,14 +381,14 @@ def process_user_input(message_container, trasncribed_text):
381
 
382
  else: # Gemini models
383
  if not st.session_state.speech_file_added:
384
- message_container.chat_message("user", avatar="user.png").markdown(prompt)
385
  content = [{"type": "text", "text": prompt}]
386
  else:
387
  content = [{"type": "text", "text": "Listen attentively to the audio. If there is a question in the audio, answer it professionally."}]
388
 
389
  update_chat_history("user", content, st.session_state.messages)
390
 
391
- with message_container.chat_message("assistant", avatar="assistant.png"):
392
  try:
393
  final_response = st.write_stream(stream_gemini_response(model_params=model_params, api_key=google_api_key))
394
 
@@ -403,7 +403,7 @@ def process_user_input(message_container, trasncribed_text):
403
 
404
  ##--- API KEYS ---##
405
  with st.sidebar:
406
- st.logo("logo.png")
407
  api_cols = st.columns(2)
408
  with api_cols[0]:
409
  with st.popover("πŸ” Groq", use_container_width=True):
@@ -424,7 +424,7 @@ else:
424
  columns = st.columns(2)
425
  # animation
426
  with columns[0]:
427
- lottie_animation = load_lottie_file("animation.json")
428
  if lottie_animation:
429
  st_lottie(lottie_animation, height=100, width=100, quality="high", key="lottie_anim")
430
 
@@ -565,7 +565,7 @@ else:
565
  valid_contents = [content for content in message["content"] if is_valid_content(content)]
566
 
567
  if valid_contents:
568
- avatar = "assistant.png" if message["role"] == "assistant" else "user.png"
569
 
570
  with message_container.chat_message(message["role"], avatar=avatar):
571
  for content in valid_contents:
@@ -573,14 +573,14 @@ else:
573
 
574
  if model_type == "groq":
575
  for msg in st.session_state.groq_chat_history:
576
- avatar = "assistant.png" if msg["role"] == "assistant" else "user.png"
577
  with message_container.chat_message(msg["role"], avatar=avatar):
578
  st.markdown(msg['content'])
579
 
580
  ###---- Summarizer model------###
581
  if model_type == "groq" and groq_llm_type == "Summarizer":
582
  if st.session_state.summarize:
583
- with message_container.chat_message("assistant", avatar="assistant.png"):
584
  if not url.strip():
585
  st.error("Please enter a URL")
586
  elif not validators.url(url):
 
17
  import edge_tts
18
 
19
  st.set_page_config(
20
+ page_title="Super AI Assistant",
21
  page_icon="⚑",
22
  layout="wide",
23
  initial_sidebar_state="auto",
 
363
  message_container.error("Couldn't recognize your speech.", icon="❌")
364
  return
365
 
366
+ message_container.chat_message("user", avatar="assets/user.png").markdown(question)
367
  update_chat_history("user", question, st.session_state.groq_chat_history)
368
 
369
+ with message_container.chat_message("assistant", avatar="assets/assistant.png"):
370
  try:
371
  final_response = handle_groq_response(model_params, groq_api_key, question,
372
  st.session_state.groq_chat_history,
 
381
 
382
  else: # Gemini models
383
  if not st.session_state.speech_file_added:
384
+ message_container.chat_message("user", avatar="assets/user.png").markdown(prompt)
385
  content = [{"type": "text", "text": prompt}]
386
  else:
387
  content = [{"type": "text", "text": "Listen attentively to the audio. If there is a question in the audio, answer it professionally."}]
388
 
389
  update_chat_history("user", content, st.session_state.messages)
390
 
391
+ with message_container.chat_message("assistant", avatar="assets/assistant.png"):
392
  try:
393
  final_response = st.write_stream(stream_gemini_response(model_params=model_params, api_key=google_api_key))
394
 
 
403
 
404
  ##--- API KEYS ---##
405
  with st.sidebar:
406
+ st.logo(image="assets/logo.png")
407
  api_cols = st.columns(2)
408
  with api_cols[0]:
409
  with st.popover("πŸ” Groq", use_container_width=True):
 
424
  columns = st.columns(2)
425
  # animation
426
  with columns[0]:
427
+ lottie_animation = load_lottie_file("assets/animation.json")
428
  if lottie_animation:
429
  st_lottie(lottie_animation, height=100, width=100, quality="high", key="lottie_anim")
430
 
 
565
  valid_contents = [content for content in message["content"] if is_valid_content(content)]
566
 
567
  if valid_contents:
568
+ avatar = "assets/assistant.png" if message["role"] == "assistant" else "assets/user.png"
569
 
570
  with message_container.chat_message(message["role"], avatar=avatar):
571
  for content in valid_contents:
 
573
 
574
  if model_type == "groq":
575
  for msg in st.session_state.groq_chat_history:
576
+ avatar = "assets/assistant.png" if msg["role"] == "assistant" else "assets/user.png"
577
  with message_container.chat_message(msg["role"], avatar=avatar):
578
  st.markdown(msg['content'])
579
 
580
  ###---- Summarizer model------###
581
  if model_type == "groq" and groq_llm_type == "Summarizer":
582
  if st.session_state.summarize:
583
+ with message_container.chat_message("assistant", avatar="assets/assistant.png"):
584
  if not url.strip():
585
  st.error("Please enter a URL")
586
  elif not validators.url(url):
animation.json β†’ assets/animation.json RENAMED
File without changes
assistant.png β†’ assets/assistant.png RENAMED
File without changes
logo.png β†’ assets/logo.png RENAMED
File without changes
assets/pic1.jpg ADDED
user.png β†’ assets/user.png RENAMED
File without changes
requirements.txt CHANGED
@@ -2,9 +2,7 @@ streamlit
2
  google-generativeai
3
  audio-recorder-streamlit
4
  streamlit_toggle
5
- streamlit-vertical-slider
6
  streamlit-lottie
7
- streamlit-float
8
  python-dotenv
9
  langchain
10
  langchain-groq
 
2
  google-generativeai
3
  audio-recorder-streamlit
4
  streamlit_toggle
 
5
  streamlit-lottie
 
6
  python-dotenv
7
  langchain
8
  langchain-groq