NaimaAqeel commited on
Commit
8d36878
·
verified ·
1 Parent(s): d382509

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -19
app.py CHANGED
@@ -1,5 +1,3 @@
1
-
2
-
3
  import os
4
  from docx import Document
5
  from sentence_transformers import SentenceTransformer
@@ -9,6 +7,7 @@ import pickle
9
  from langchain_community.llms import HuggingFaceEndpoint
10
  from langchain_community.vectorstores import FAISS
11
  from langchain_community.embeddings import HuggingFaceEmbeddings
 
12
 
13
  # Initialize the embedding model
14
  embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
@@ -112,15 +111,17 @@ def query_text(text):
112
  return f"Error querying text: {e}"
113
 
114
  # Sample Gradio integration (for illustration)
115
- import gradio as gr
116
-
117
  def main():
118
  gr.Interface(
119
- [upload_files, query_text],
120
- ["files", "text"],
121
- ["text", "text"],
122
- title="Document Upload and Query System",
123
- description="Upload DOCX files to build an index, then query for answers based on uploaded documents.",
 
 
 
 
124
  ).launch()
125
 
126
  if __name__ == "__main__":
@@ -135,13 +136,3 @@ if __name__ == "__main__":
135
 
136
 
137
 
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
 
 
 
1
  import os
2
  from docx import Document
3
  from sentence_transformers import SentenceTransformer
 
7
  from langchain_community.llms import HuggingFaceEndpoint
8
  from langchain_community.vectorstores import FAISS
9
  from langchain_community.embeddings import HuggingFaceEmbeddings
10
+ import gradio as gr
11
 
12
  # Initialize the embedding model
13
  embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
 
111
  return f"Error querying text: {e}"
112
 
113
  # Sample Gradio integration (for illustration)
 
 
114
  def main():
115
  gr.Interface(
116
+ [
117
+ upload_files,
118
+ query_text
119
+ ],
120
+ [
121
+ "files",
122
+ "text"
123
+ ],
124
+ "text"
125
  ).launch()
126
 
127
  if __name__ == "__main__":
 
136
 
137
 
138