Vlad Bastina commited on
Commit
0e4d60e
·
1 Parent(s): e601c67

display images

Browse files
Files/brochure_1.txt ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ZEGA AI Capabilities Overview for Clients
2
+ This document outlines ZEGA AI's current and near-future capabilities, designed to address specific business needs with tailored AI solutions. We categorize our offerings by function and implementation effort, allowing you to quickly assess potential solutions for your unique requirements.
3
+ I. AI-Powered Analysis & Insights
4
+ A. Cross-Contextual Analysis (Wikis, Code, Documents): Imagine a single AI system that seamlessly analyzes your internal wikis, code repositories, documents, and even meeting transcripts. This solution provides holistic insights into your projects, identifies potential issues (e.g., code vulnerabilities, documentation gaps), assesses code quality, ensures compliance with organizational standards, and tracks project progress. By connecting these disparate data sources, we uncover hidden patterns and risks, leading to improved efficiency, reduced errors, and better decision-making.
5
+
6
+ [cross-contextual_analysis.png]
7
+
8
+ B. Smart Document Q&A: Unlock the knowledge trapped in your complex documents. Our AI-powered system leverages Retrieval Augmented Generation (RAG) to provide precise answers to your questions. Demonstrated 5x lower error rate than ChatGPT in specific tests. Supports multiple languages, on-premise deployment for enhanced security, and various document formats (PDF, etc.). Ideal for compliance, legal research, knowledge management, and competitive intelligence.
9
+
10
+ [rag.png] [rag_overview.png]
11
+
12
+ C. Document Summarization: Quickly grasp the core information from lengthy or complex reports, articles, and legal documents. Our AI generates concise, accurate summaries using a two-step iterative process, ensuring high fidelity and easy comprehension. This solution drastically reduces time spent on information gathering and analysis, freeing up your team for more strategic tasks.
13
+
14
+ D. Smart Document Comparison: Go beyond simple text comparisons. Our AI highlights the substantive differences between document versions, providing contextual insights into the changes. Results are presented in clear, organized formats (tabular or bullet points), summarizing high-impact changes and maintaining a history of comparisons for audit trails. Ideal for legal, compliance, contract review, and regulatory document analysis.
15
+
16
+ [smart_document_comparison.png]
17
+
18
+ E. Excel Data Retrieval & Analysis: Empower your team to access insights from Excel data without needing advanced spreadsheet skills. Our AI-powered solution utilizes natural language queries to extract, analyze, and summarize data, automating reporting and analysis tasks.
19
+
20
+ [excel_data_retrival_analysis.png]
21
+
22
+ F. AI-Powered Document Translation: Break down language barriers with our accurate and efficient document translation service. Supporting multiple languages, our AI preserves context and technical nuances, ensuring clear communication across global teams and markets. Seamless integration with existing workflows minimizes disruption.
23
+
24
+ II. Meeting Management & Transcription
25
+
26
+ A. Meeting Audio to Text: Transform audio recordings of your meetings into searchable, actionable text. Our high-accuracy AI-powered transcription service supports custom vocabularies for industry-specific terminology, ensuring precise and relevant transcriptions.
27
+
28
+ [audio_meeting_to_text.png]
29
+
30
+ B. Audio Transcript AI Correction: Enhance the quality of your transcripts with our AI-powered correction service. By analyzing conversational context, our system corrects inaccuracies, handles multiple languages and timestamps, and incorporates custom vocabularies for jargon or abbreviations. Ideal for both real-time and asynchronous transcription scenarios.
31
+
32
+ III. Conversational AI & Chatbots
33
+
34
+ A. Documentation-Aware Chatbot: Deploy a smart chatbot that instantly accesses information from your specific documents, providing accurate and relevant answers to user queries via API. Built-in features like user action confirmation dialogs, guardrails to prevent errors, and parameter completion for handling incomplete requests enhance user experience and ensure data integrity. Outperforms general-purpose models for targeted, document-specific Q&A.
35
+
36
+ B. Collaboration Platform Chatbot: Integrate a knowledgeable AI assistant directly into your collaboration platforms (e.g., Teams, Slack). This chatbot answers user questions by searching your designated knowledge base, providing instant access to relevant information within the flow of work. Session context and efficient indexing ensure quick and accurate responses.
37
+
38
+ IV. Computer Vision & Image Processing
39
+
40
+ [computer_vision.png]
41
+
42
+ A. Object Detection: Identify and locate specific objects within images or video frames. Our high-precision object detection provides bounding boxes around recognized objects, enabling applications such as quality control (flagging defects), automated sketch interpretation (converting drawings into digital designs), and inventory management (recognizing products).
43
+
44
+ [object_detection.png]
45
+
46
+ B. Image Segmentation: Achieve pixel-perfect object delineation with our image segmentation capabilities. By creating precise masks for each object, we enable detailed analysis of shape, size, and other characteristics. Applications include medical imaging (differentiating tissue types), autonomous vehicles (distinguishing obstacles), and industrial inspection (detecting defects).
47
+
48
+ [image_segmentation.png]
49
+
50
+ C. Image Classification: Categorize large image datasets quickly and accurately. Our AI-powered image classification utilizes domain-specific models tailored to your industry or use case. Deployable on cloud or edge devices for flexible and efficient image analysis. Applications include retail product categorization, healthcare image analysis (e.g., identifying anomalies in medical scans), and social media moderation.
51
+
52
+ [image_classification.png]
53
+
54
+ D. Object Tracking: Monitor object movement and behavior in video feeds. Our object tracking technology continuously analyzes object positions, velocity, and direction, providing valuable insights for security/surveillance, workflow optimization (e.g., analyzing traffic flow), and safety monitoring.
55
+
56
+ [object_tracking.png]
57
+
58
+ E. Depth Perception: Add a crucial dimension to your computer vision capabilities. Our depth perception technology uses stereo or monocular methods to determine the distance and 3D relationships between objects. This enhances tracking accuracy, improves anomaly detection, and enables object counting in complex scenes. Applications include warehouse robotics, autonomous navigation, and 3D scene reconstruction.
59
+
60
+ [depth_perception.png]
61
+
62
+ F. Full Video Pipelines:Develop comprehensive video analysis solutions tailored to your specific requirements. From object detection and tracking to event interpretation and anomaly detection, we build end-to-end pipelines that operate in real-time or batch modes. Applications include advanced security systems, automated manufacturing processes, and smart city management solutions.
63
+
64
+ [full_video_pipelines.png]
65
+
66
+ G. OCR with AI Correction: Digitize paper-based information efficiently and accurately. Our OCR solution extracts text from images in multiple languages and applies AI-powered grammar and semantic correction, minimizing manual data entry and errors. Supports complex layouts, diverse fonts, and outputs in .txt or .json formats.
67
+
68
+ [optical_character_recognition.png]
69
+
70
+ H. Virtual Try-On/Overlay: Enhance customer experience and boost sales with our virtual try-on solutions. We offer various levels of functionality, from 2D overlay (clothing on photos) to 3D visualizations with pose adjustment and multiple view options. Contact us to discuss your specific needs and explore the possibilities.
71
+
72
+ [2d_try-on.png] [3d_from_image.png] [adjustable_pose.png] [diversity_of_views.png] [diversity_of_views_2.png]
73
+
74
+ I. Small, Energy-Efficient Neural Networks: Deploy AI capabilities on resource-constrained devices like drones and embedded systems. Our compact neural networks are optimized for size and energy efficiency, enabling on-device processing without the need for a server. Focus areas include human presence detection for safe operation and obstacle avoidance.
75
+
76
+ V. Specialized AI Solutions
77
+
78
+ A. SQL Code Creation from Natural Language: Empower non-technical users to interact with databases using simple language. Our AI translates natural language requests into SQL queries, simplifying data access and reporting. Compatible with a wide range of database systems.
79
+
80
+ [sql_code_creation_from_nl.png]
81
+
82
+ B. Unstructured Data Structuring: Transform unstructured text data into valuable structured insights. Our AI automatically converts freeform text into organized formats (JSON, CSV, database entries), integrates with external systems through APIs or function calls, and validates extracted data for accuracy and consistency. This enables streamlined workflows, automated reporting, and efficient data analysis.
83
+
84
+ VI. Optimized LLM Deployment
85
+
86
+ A. Private, Faster, Smaller, Cheaper LLMs: Harness the power of large language models (LLMs) without compromising on security, speed, or budget. We specialize in optimizing LLMs for private, on-premise deployments, ensuring your sensitive data remains within your control. Our techniques include quantization, pruning, caching, and dynamic resource allocation, leading to faster processing, reduced model size, and lower operational costs. We can tailor LLM deployments to your specific needs, maximizing performance while minimizing resource consumption. This allows you to leverage cutting-edge language AI for tasks like text generation, summarization, translation, and question answering, all within a secure and cost-effective environment.
87
+
Files/brochure_2.txt ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ZEGA AI Document Capabilities for Clients
2
+
3
+ This document showcases ZEGA AI's offerings tailored for companies needs, focusing on practical applications and demonstrable value. We categorize capabilities by function and provide clear status indicators:
4
+
5
+ I. Document Intelligence
6
+
7
+ A. Smart Document Q&A (RAG):
8
+ Value Proposition: Empower your teams to quickly and accurately extract insights from complex documents, reducing research time and improving decision-making.
9
+ Key Features: Transforms documents into searchable vector formats. Leverages Retrieval Augmented Generation (RAG) for precise answers with source citations. Handles multiple languages and offers on-premise deployment for enhanced security.
10
+ Competitive Advantage: Demonstrated 5x lower error rate than ChatGPT in comparative tests, ensuring higher accuracy and reliability.
11
+ Use Cases: Compliance research, due diligence, knowledge management, competitive analysis.
12
+
13
+ [rag.png] [rag_overview.png]
14
+
15
+ B. Smart Document Q&A (Gemini):
16
+ Value Proposition: Unlock the power of large language models with an intuitive chatbot interface for document comprehension.
17
+ Key Features: Handles large context (600+ pages), provides summaries, interpretations, and translations, and supports multiple languages. Can be deployed on-premise. [Provide link to live demo].
18
+ Use Cases: Rapid knowledge extraction, complex document analysis, multilingual support for global teams.
19
+
20
+ C. Smart Search on Documents (RAC):
21
+ Value Proposition: Streamline document search and retrieval with AI-powered precision.
22
+ Key Features: Vectorizes documents for efficient searching using RAG. Supports multiple languages and on-premise deployment.
23
+ Use Cases: Knowledge discovery, research acceleration, enhanced document management systems.
24
+
25
+ D. Document Summarization:
26
+ Value Proposition: Condense lengthy documents into concise summaries, saving time and facilitating faster comprehension. [Provide link to live demo].
27
+ Key Features: High-fidelity summaries, handles unlimited document length, correlates summaries with original text.
28
+ Use Cases: Executive briefings, report analysis, due diligence preparation, knowledge sharing.
29
+
30
+ E. Smart Document Comparison:
31
+ Value Proposition: Quickly identify and analyze critical differences between document versions, streamlining review processes and ensuring accuracy.
32
+ Key Features: AI-powered semantic comparison, highlights high-impact changes, provides contextual summaries, and maintains an audit trail.
33
+ Use Cases: Legal and regulatory compliance, contract review, policy updates, version control.
34
+
35
+ [smart_document_comparison.png]
36
+
37
+ F. Smart CSV Question Answering and Visualization
38
+ Description: An AI-powered chatbot that allows users to query CSV data in natural language and receive answers accompanied by relevant visualizations. This tool simplifies data exploration and analysis, making insights readily accessible even to users without specialized data science skills.
39
+ Features:
40
+ Natural Language Querying: Users can ask questions about the data in plain English, without needing to write SQL queries or use complex data manipulation tools.
41
+ CSV Data Input: Directly processes CSV files, a common and widely used format for tabular data.
42
+ Automated Plot Generation: Automatically generates appropriate plots (e.g., bar charts, line graphs, scatter plots, histograms) to visually represent the data relevant to the user's query. The chatbot intelligently selects the best chart type based on the data and the question asked.
43
+ Contextual Understanding: Leverages a language model to understand the context of the user's question and relate it to the column headers and data within the CSV.
44
+ Data Type Inference: Automatically infers data types (e.g., numerical, categorical, date/time) from the CSV content to enable appropriate analysis and visualization.
45
+ Data Aggregation and Filtering: Implicitly performs necessary data aggregations (e.g., sums, averages, counts) and filtering based on the user's query.
46
+ Explanations: Beside the plot, generates a textual explanation of the results.
47
+ Benefits:
48
+ Accessibility: Makes data analysis accessible to a wider audience, regardless of technical expertise.
49
+ Speed and Efficiency: Provides quick answers and visualizations, eliminating the need for manual data manipulation and charting.
50
+ Improved Understanding: Visualizations aid in understanding data trends and patterns that might be missed in raw tabular data.
51
+ Data-Driven Decision Making: Empowers users to make informed decisions based on readily available data insights.
52
+ Reduced Errors: Automates the process of data analysis, reducing the risk of human error in calculations and visualizations.
53
+ Private: This bot can be installed on premises on your local private infrastructure.
54
+ Details:
55
+ Supports large CSV files.
56
+ Handles various date and number formats.
57
+ Provides clear and concise explanations of the generated plots.
58
+ Secures private document data, not needing to send the information via the internet like with ChatGPT.
59
+
60
+ [smart_csv_question_answering.png] [smart_csv_question_answering_2.png]
61
+
62
+ II. Meeting Management & Transcription
63
+
64
+ A. Audio Meetings to Text:
65
+ Value Proposition: Transform audio meetings into searchable text, facilitating efficient record-keeping and analysis.
66
+ Key Features: High-accuracy AI transcription, custom vocabulary integration, automated corrections.
67
+ Use Cases: Meeting minutes, action item tracking, post-meeting analysis, searchable archives.
68
+
69
+ [audio_meeting_to_text.png]
70
+
71
+ B. Audio Transcript AI Correction:
72
+ Value Proposition: Enhance the accuracy and readability of transcripts, ensuring clear and reliable records of conversations.
73
+ Key Features: Contextual correction via LLMs, handles multiple languages, timestamps, and custom vocabularies.
74
+ Use Cases: Legal proceedings, research interviews, meeting transcription refinement.
75
+
76
+ C. Video Meeting Summarization:
77
+ Value Proposition: Quickly grasp the key takeaways from video meetings with AI-generated summaries.
78
+ Key Features: Combines transcription and summarization capabilities for concise and actionable insights.
79
+ Use Cases: Meeting efficiency, knowledge sharing, remote team collaboration.
80
+
81
+ D. Image to Text (OCR):
82
+ Value Proposition: Digitize printed documents and images, unlocking valuable data and improving accessibility.
83
+ Key Features: Automated text extraction with AI-powered correction, handles complex layouts and diverse fonts.
84
+ Use Cases: Data entry automation, document archiving, accessibility improvements.
85
+
86
+ [optical_character_recognition.png]
87
+
88
+ III. Conversational AI & Chatbots
89
+
90
+ A. Documentation-Aware Chatbot:
91
+ Value Proposition: Provide instant access to information within specific documents through an interactive chatbot interface.
92
+ Key Features: API-accessible, intelligent indexing, optimized prompts, robust error handling.
93
+ Use Cases: Customer support, internal knowledge bases, training and onboarding.
94
+
95
+ B. Collaboration Platform-Integrated Chatbot:
96
+ Value Proposition: Seamlessly integrate AI-powered Q&A within existing collaboration platforms, enhancing team communication and knowledge sharing.
97
+ Key Features: Connects to platforms like Teams and Slack, automatic knowledge base retrieval, context-aware responses.
98
+ Use Cases: Internal help desks, project collaboration, employee self-service.
99
+
Files/ZEGA AI Capabilities Overview for Clients (1).docx → ZegaPos/2d_try-on.png RENAMED
File without changes
ZegaPos/3d_from_image.png ADDED

Git LFS Details

  • SHA256: db3a658807cfe488a3a6d4038947af5897dd64dba49ce3ce6f2acb756ba0a531
  • Pointer size: 131 Bytes
  • Size of remote file: 319 kB
ZegaPos/adjustable_pose.png ADDED

Git LFS Details

  • SHA256: 94ef349722986dfec7c2dc23265c0490d1f1c6df0d4e0b6ccc5ae5762fef729b
  • Pointer size: 131 Bytes
  • Size of remote file: 254 kB
Files/ZEGA AI Document Capabilities Overview for Clients (1).docx → ZegaPos/audio_meeting_to_text.png RENAMED
File without changes
ZegaPos/computer_vision.png ADDED

Git LFS Details

  • SHA256: 0206f9dc5e304e3bf9a69f27dd58d2ea27afb448abea349ec587a8127d601e88
  • Pointer size: 131 Bytes
  • Size of remote file: 222 kB
ZegaPos/cross-contextual_analysis.png ADDED

Git LFS Details

  • SHA256: 7f600954d7f30ae7c4c29ce7c845bff963ecaf411d8f0791c2b148fd5e363387
  • Pointer size: 130 Bytes
  • Size of remote file: 16.9 kB
ZegaPos/depth_perception.png ADDED

Git LFS Details

  • SHA256: b612b028f48d4862369f8766cb04a8e3e82522398a4f4f1e5ae6b661ce1b7069
  • Pointer size: 131 Bytes
  • Size of remote file: 455 kB
ZegaPos/diversity_of_views.png ADDED

Git LFS Details

  • SHA256: e4923951d2e3c1942df06ef6f75a3db5fb37f3ede1c88191bdcd949748969f84
  • Pointer size: 132 Bytes
  • Size of remote file: 1.04 MB
ZegaPos/diversity_of_views_2.png ADDED

Git LFS Details

  • SHA256: 41e6a8fd2118b2b5a1b2ec6901815275e835858a3f523ffafa9179af910753d6
  • Pointer size: 131 Bytes
  • Size of remote file: 341 kB
ZegaPos/excel_data_retrival_analysis.png ADDED

Git LFS Details

  • SHA256: 764cabe30343187c726b69ed523f61fdccc99b38335aa217598ee4f057661bad
  • Pointer size: 131 Bytes
  • Size of remote file: 236 kB
ZegaPos/full_video_pipelines.png ADDED

Git LFS Details

  • SHA256: 17b37428bca3ee9790009ca93349e1fa9da4bea47ef05524d0cf5068d6abbd37
  • Pointer size: 131 Bytes
  • Size of remote file: 286 kB
ZegaPos/image_classification.png ADDED

Git LFS Details

  • SHA256: 7707fefaef8dfa3871592622c90327174eb08575edfc60c5970f9b7f21f23049
  • Pointer size: 131 Bytes
  • Size of remote file: 163 kB
ZegaPos/image_segmentation.png ADDED

Git LFS Details

  • SHA256: e948611168ae2e0c96a11746d3332aa4a0a6e1816285d320cbb86b4e6129d0c4
  • Pointer size: 131 Bytes
  • Size of remote file: 207 kB
ZegaPos/object_detection.png ADDED

Git LFS Details

  • SHA256: 93124395b0059cc215e0d21728b943922266d828235a073bcdb60024b3b88587
  • Pointer size: 131 Bytes
  • Size of remote file: 253 kB
ZegaPos/object_tracking.png ADDED

Git LFS Details

  • SHA256: b7e1eb8c83aef102e95b7ef85dcbb97cd73bab83b1eefc81435210ff549e878c
  • Pointer size: 131 Bytes
  • Size of remote file: 165 kB
ZegaPos/optical_character_recognition.png ADDED

Git LFS Details

  • SHA256: e631063d33c64bb480c0017574cfcf5cc0d25d926bf7ba017f96dd14d12b5a93
  • Pointer size: 131 Bytes
  • Size of remote file: 294 kB
ZegaPos/rag.png ADDED

Git LFS Details

  • SHA256: 0451e271c67193f1e4ec1622bfb2673ae6e8e873c7e26c101cd31d87305cda15
  • Pointer size: 130 Bytes
  • Size of remote file: 24.2 kB
ZegaPos/rag_overview.png ADDED

Git LFS Details

  • SHA256: 4efb5078328d5f417a93736a8daa75b728aa237c6a1f3cad3466baecb02a02f8
  • Pointer size: 130 Bytes
  • Size of remote file: 35.7 kB
ZegaPos/smart_csv_question_answering.png ADDED

Git LFS Details

  • SHA256: ccc1e5ec7ba89ea1973c7607899830f0a80038969d6adf4c0957910aa3794ae5
  • Pointer size: 130 Bytes
  • Size of remote file: 29.9 kB
ZegaPos/smart_csv_question_answering_2.png ADDED

Git LFS Details

  • SHA256: 37529d610542e26f3aaa3986bf9a99ed25de5d2986ca5198deb01b36811ab2ff
  • Pointer size: 130 Bytes
  • Size of remote file: 63.7 kB
ZegaPos/smart_document_comparison.png ADDED

Git LFS Details

  • SHA256: 7fe5f7cba8743e4dc152da244f93e01dd4c50b8759730e9d86d32709c28b402c
  • Pointer size: 130 Bytes
  • Size of remote file: 84.8 kB
ZegaPos/sql_code_creation_from_nl.png ADDED

Git LFS Details

  • SHA256: cae70f240858881cdd2910377ec685d39b4c3f9db16da94c0354647920f6d9a3
  • Pointer size: 130 Bytes
  • Size of remote file: 36.3 kB
app.py CHANGED
@@ -1,18 +1,18 @@
1
  import streamlit as st
2
  import os
 
3
  from query_chat import GeminiQanA
4
  from docx import Document
5
 
6
- # Function to read text from a Word document
7
- def extract_text_from_docx(file_path):
8
- doc = Document(file_path)
9
- return " ".join([para.text.strip() for para in doc.paragraphs if para.text.strip()])
10
 
11
  @st.cache_resource()
12
  def load_chatbot():
13
  with st.spinner("Loading project information..."):
14
- doc1_text = extract_text_from_docx("Files/ZEGA AI Capabilities Overview for Clients (1).docx")
15
- doc2_text = extract_text_from_docx("Files/ZEGA AI Document Capabilities Overview for Clients (1).docx")
16
 
17
  return GeminiQanA(doc1_text, doc2_text)
18
 
@@ -30,11 +30,6 @@ if "GOOGLE_API_KEY" in st.secrets:
30
  else:
31
  st.error("API key missing! Please set up your Google API key in Streamlit secrets.")
32
 
33
- # Load documents
34
- with st.spinner("Loading project information..."):
35
- doc1_text = extract_text_from_docx("Files/ZEGA AI Capabilities Overview for Clients (1).docx")
36
- doc2_text = extract_text_from_docx("Files/ZEGA AI Document Capabilities Overview for Clients (1).docx")
37
-
38
  # Initialize chatbot
39
  chatbot = load_chatbot()
40
 
@@ -45,10 +40,30 @@ if "messages" not in st.session_state:
45
  # Chat UI
46
  st.title("📄 Zega AI Sales Agent")
47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  # Display chat history
49
  for message in st.session_state.messages:
50
- with st.chat_message(message["role"]):
51
- st.markdown(message["content"])
52
 
53
  # User Input
54
  question = st.text_area("Ask a question about Zega AI:", height=100)
@@ -72,8 +87,7 @@ if ask_button and question:
72
  st.session_state.messages.append({"role": "user", "content": question})
73
 
74
  # Display user message
75
- with st.chat_message("user"):
76
- st.markdown(question)
77
 
78
  # Generate AI response
79
  with st.spinner("💡 Thinking..."):
@@ -82,8 +96,7 @@ if ask_button and question:
82
  # Append AI response
83
  st.session_state.messages.append({"role": "assistant", "content": answer})
84
 
85
- # Display AI response
86
- with st.chat_message("assistant"):
87
- st.markdown(answer)
88
 
89
  st.rerun()
 
1
  import streamlit as st
2
  import os
3
+ import re
4
  from query_chat import GeminiQanA
5
  from docx import Document
6
 
7
+ def extract_text_from_txt(file_path):
8
+ with open(file_path, "r", encoding="utf-8") as file:
9
+ return " ".join([line.strip() for line in file.readlines() if line.strip()])
 
10
 
11
  @st.cache_resource()
12
  def load_chatbot():
13
  with st.spinner("Loading project information..."):
14
+ doc1_text = extract_text_from_txt("Files/brochure_1.txt")
15
+ doc2_text = extract_text_from_txt("Files/brochure_2.txt")
16
 
17
  return GeminiQanA(doc1_text, doc2_text)
18
 
 
30
  else:
31
  st.error("API key missing! Please set up your Google API key in Streamlit secrets.")
32
 
 
 
 
 
 
33
  # Initialize chatbot
34
  chatbot = load_chatbot()
35
 
 
40
  # Chat UI
41
  st.title("📄 Zega AI Sales Agent")
42
 
43
+ # Function to display messages and replace image tags with actual images
44
+ def display_message(role, content):
45
+ with st.chat_message(role):
46
+ # Find all image tags in the response
47
+ image_tags = re.findall(r"\[(.*?\.png)]", content)
48
+
49
+ # Split response by image tags and process separately
50
+ parts = re.split(r"\[(.*?\.png)]", content)
51
+
52
+ for part in parts:
53
+ if part in image_tags:
54
+ # If it's an image tag, check if the image exists and display it
55
+ image_path = f"ZegaPos/{part}"
56
+ if os.path.exists(image_path):
57
+ st.image(image_path, use_container_width=True)
58
+ else:
59
+ st.markdown(f"⚠️ Image `{part}` not found.")
60
+ else:
61
+ # Otherwise, display text
62
+ st.markdown(part)
63
+
64
  # Display chat history
65
  for message in st.session_state.messages:
66
+ display_message(message["role"], message["content"])
 
67
 
68
  # User Input
69
  question = st.text_area("Ask a question about Zega AI:", height=100)
 
87
  st.session_state.messages.append({"role": "user", "content": question})
88
 
89
  # Display user message
90
+ display_message("user", question)
 
91
 
92
  # Generate AI response
93
  with st.spinner("💡 Thinking..."):
 
96
  # Append AI response
97
  st.session_state.messages.append({"role": "assistant", "content": answer})
98
 
99
+ # Display AI response with image handling
100
+ display_message("assistant", answer)
 
101
 
102
  st.rerun()
query_chat.py CHANGED
@@ -13,38 +13,55 @@ class GeminiQanA:
13
 
14
  def _load_model(self):
15
  """Loads the generative AI model without the conversation history (history will be passed dynamically)."""
16
- system_instruction = f'''Role:
17
  You are a sales agent responsible for assisting customers by answering questions about our team’s capabilities and the projects we offer. You have access to two brochures that detail the available projects and their features. Your goal is to provide accurate and honest responses based solely on the information within these brochures.
18
 
19
- Guidelines for Responses:
20
- 1. Accuracy & Honesty
21
- -Only provide responses based on the brochures.
22
- -Do not overstate or exaggerate the capabilities of the team.
23
- -If information is not available in the brochures, do not speculate—politely inform the customer that the requested details are not available.
24
- 2. Answering Questions About the Team’s Capabilities & Projects
25
- -When a customer asks about what our team can do, provide information only from the brochures.
26
- -If asked about past projects, refer only to those explicitly mentioned in the brochures.
27
- -If the customer asks for additional details not found in the brochures, politely inform them that you can only share the information available.
28
- 3. Providing Solutions to Customer Problems
29
- -If a customer presents a problem, check if a project in the brochures provides a direct solution.
30
- -If a matching project exists, explain how it can address their problem.
31
- -If an alternative but related project exists, suggest it as a partial solution, explaining its limitations.
32
- -If no project can help, politely state that no suitable solution is available.
33
- 4. What Not to Do
34
- -Do not create new information or assume additional capabilities.
35
- -Do not make guarantees beyond what is stated in the brochures.
36
- -Do not offer speculative solutions that are not explicitly supported by the documents.
37
-
38
- Tone & Style:
39
- Maintain a professional, helpful, and customer-focused tone.
40
- Keep responses concise yet informative based on brochure content.
41
- If a solution exists, explain how it meets the customer's needs without overselling.
42
- If no solution exists, remain polite and transparent.
43
-
44
- First Brochure:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  {self.text1}
46
 
47
- Second Brochure:
48
  {self.text2}
49
  '''
50
  return genai.GenerativeModel("gemini-2.0-flash", system_instruction=system_instruction)
 
13
 
14
  def _load_model(self):
15
  """Loads the generative AI model without the conversation history (history will be passed dynamically)."""
16
+ system_instruction = f'''# Role:
17
  You are a sales agent responsible for assisting customers by answering questions about our team’s capabilities and the projects we offer. You have access to two brochures that detail the available projects and their features. Your goal is to provide accurate and honest responses based solely on the information within these brochures.
18
 
19
+ ---
20
+
21
+ ## Guidelines for Responses:
22
+
23
+ ### 1. Accuracy & Honesty
24
+ - Only provide responses based on the brochures.
25
+ - Do not overstate or exaggerate the capabilities of the team.
26
+ - If information is not available in the brochures, do not speculate—politely inform the customer that the requested details are not available.
27
+
28
+ ### 2. Answering Questions About the Team’s Capabilities & Projects
29
+ - When a customer asks about what our team can do, provide information only from the brochures.
30
+ - If asked about past projects, refer only to those explicitly mentioned in the brochures.
31
+ - If the customer asks for additional details not found in the brochures, politely inform them that you can only share the information available.
32
+
33
+ ### 3. Providing Solutions to Customer Problems
34
+ - If a customer presents a problem, check if a project in the brochures provides a direct solution.
35
+ - If a matching project exists, explain how it can address their problem.
36
+ - If an alternative but related project exists, suggest it as a partial solution, explaining its limitations.
37
+ - If no project can help, politely state that no suitable solution is available.
38
+
39
+ ### 4. Handling Image Tags in Responses
40
+ - Some solutions in the brochures may be followed by an image tag in the format `[solution_name.png]`.
41
+ - If an image tag appears in the provided brochure text, **include it exactly as it is when presenting the solution**.
42
+ - Do not generate new image tags—only use them when they appear in the brochures.
43
+
44
+ ### 5. What Not to Do
45
+ - Do not create new information or assume additional capabilities.
46
+ - Do not make guarantees beyond what is stated in the brochures.
47
+ - Do not offer speculative solutions that are not explicitly supported by the documents.
48
+
49
+ ---
50
+
51
+ ## Tone & Style:
52
+ - Maintain a professional, helpful, and customer-focused tone.
53
+ - Keep responses concise yet informative based on brochure content.
54
+ - If a solution exists, explain how it meets the customer's needs without overselling.
55
+ - If no solution exists, remain polite and transparent.
56
+
57
+ ---
58
+
59
+ ## Brochure Content:
60
+
61
+ ### First Brochure:
62
  {self.text1}
63
 
64
+ ### Second Brochure:
65
  {self.text2}
66
  '''
67
  return genai.GenerativeModel("gemini-2.0-flash", system_instruction=system_instruction)