NHZ commited on
Commit
af61ce0
·
verified ·
1 Parent(s): 9b74dad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -18
app.py CHANGED
@@ -5,7 +5,6 @@ import pdfplumber
5
  import streamlit as st
6
  import faiss
7
  from sentence_transformers import SentenceTransformer
8
- from groq import Groq
9
 
10
  # Constants
11
  DOCUMENT_URL = "https://drive.google.com/file/d/1XvqA1OIssRs2gbmOtKFKj-02yQ5X2yg0/view?usp=sharing"
@@ -59,8 +58,8 @@ def query_faiss(query, index, chunks, model, k=5):
59
 
60
  # Streamlit application
61
  def main():
62
- st.title("RAG-based Application")
63
- st.write("This application uses a pre-configured document as the dataset for query responses.")
64
 
65
  # Download and process the document
66
  st.write("Processing the pre-configured document...")
@@ -83,21 +82,6 @@ def main():
83
  for i, result in enumerate(results):
84
  st.write(f"{i+1}. {result}")
85
 
86
- # Groq API interaction
87
- groq_api_key = os.environ.get("GROQ_API_KEY") # Fetch API key from Hugging Face Secrets
88
- if groq_api_key:
89
- client = Groq(api_key=groq_api_key)
90
- if query:
91
- st.write("Fetching response from Groq API...")
92
- chat_completion = client.chat.completions.create(
93
- messages=[{"role": "user", "content": query}],
94
- model="llama-3.3-70b-versatile"
95
- )
96
- st.write("Response:")
97
- st.write(chat_completion.choices[0].message.content)
98
- else:
99
- st.error("Groq API key not configured in Hugging Face Secrets.")
100
-
101
  if __name__ == "__main__":
102
  main()
103
 
 
5
  import streamlit as st
6
  import faiss
7
  from sentence_transformers import SentenceTransformer
 
8
 
9
  # Constants
10
  DOCUMENT_URL = "https://drive.google.com/file/d/1XvqA1OIssRs2gbmOtKFKj-02yQ5X2yg0/view?usp=sharing"
 
58
 
59
  # Streamlit application
60
  def main():
61
+ st.title("Document-Based Query Application")
62
+ st.write("This application uses a pre-configured document as the dataset for answering queries.")
63
 
64
  # Download and process the document
65
  st.write("Processing the pre-configured document...")
 
82
  for i, result in enumerate(results):
83
  st.write(f"{i+1}. {result}")
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  if __name__ == "__main__":
86
  main()
87