Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -40,8 +40,6 @@ class Chatbot:
|
|
| 40 |
try:
|
| 41 |
self.vectorstore = FAISS.load_local('faiss_index', HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2", model_kwargs={"device": "cuda"}))
|
| 42 |
# self.vectorstore = FAISS.load_local('faiss_index', HuggingFaceEmbeddings(model_name="flax-sentence-embeddings/all_datasets_v3_MiniLM-L12", model_kwargs={"device": "cuda"}))
|
| 43 |
-
# cpu_index = faiss.read_index('faiss_index_new_model3.index')
|
| 44 |
-
# gpu_index = faiss.index_cpu_to_gpu(gpu_resource, 0, cpu_index)
|
| 45 |
print("Loaded embedding successfully")
|
| 46 |
except ImportError as e:
|
| 47 |
print("FAISS could not be imported. Make sure FAISS is installed correctly.")
|
|
@@ -143,4 +141,31 @@ class Chatbot:
|
|
| 143 |
|
| 144 |
# Instantiate and launch the chatbot
|
| 145 |
chatbot = Chatbot()
|
| 146 |
-
chatbot.launch_interface()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
try:
|
| 41 |
self.vectorstore = FAISS.load_local('faiss_index', HuggingFaceEmbeddings(model_name="sentence-transformers/all-mpnet-base-v2", model_kwargs={"device": "cuda"}))
|
| 42 |
# self.vectorstore = FAISS.load_local('faiss_index', HuggingFaceEmbeddings(model_name="flax-sentence-embeddings/all_datasets_v3_MiniLM-L12", model_kwargs={"device": "cuda"}))
|
|
|
|
|
|
|
| 43 |
print("Loaded embedding successfully")
|
| 44 |
except ImportError as e:
|
| 45 |
print("FAISS could not be imported. Make sure FAISS is installed correctly.")
|
|
|
|
| 141 |
|
| 142 |
# Instantiate and launch the chatbot
|
| 143 |
chatbot = Chatbot()
|
| 144 |
+
chatbot.launch_interface()
|
| 145 |
+
|
| 146 |
+
"""Single Tab Input Inference"""
|
| 147 |
+
|
| 148 |
+
# def launch_interface(self):
|
| 149 |
+
# css_code = """
|
| 150 |
+
# .gradio-container {
|
| 151 |
+
# background-color: #daccdb;
|
| 152 |
+
# }
|
| 153 |
+
|
| 154 |
+
# /* Button styling for all buttons */
|
| 155 |
+
# button {
|
| 156 |
+
# background-color: #927fc7; /* Default color for all other buttons */
|
| 157 |
+
# color: black;
|
| 158 |
+
# border: 1px solid black;
|
| 159 |
+
# padding: 10px;
|
| 160 |
+
# margin-right: 10px;
|
| 161 |
+
# font-size: 16px; /* Increase font size */
|
| 162 |
+
# font-weight: bold; /* Make text bold */
|
| 163 |
+
# }
|
| 164 |
+
|
| 165 |
+
# """
|
| 166 |
+
# EXAMPLES = ["TDA4 product planning and datasheet release progress? ",
|
| 167 |
+
# "I'm using Code Composer Studio 5.4.0.00091 and enabled FPv4SPD16 floating point support for CortexM4 in TDA2. However, after building the project, the .asm file shows --float_support=vfplib instead of FPv4SPD16. Why is this happening?",
|
| 168 |
+
# "Master core in TDA2XX is a15 and in TDA3XX it is m4,so we have to shift all modules that are being used by a15 in TDA2XX to m4 in TDA3xx."]
|
| 169 |
+
|
| 170 |
+
# demo = gr.Interface(fn=self.qa_infer, inputs=[gr.Textbox(label="QUERY", placeholder ="Enter your query here")], allow_flagging='never', examples=EXAMPLES, cache_examples=False, outputs=[gr.Textbox(label="SOLUTION"), gr.Textbox(label="RELATED QUERIES"), gr.HTML()], css=css_code)
|
| 171 |
+
# demo.launch()
|