Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -136,27 +136,6 @@ def load_vectorstore(model_name: os.PathLike, model_kwargs: dict):
|
|
136 |
return vector_store
|
137 |
|
138 |
|
139 |
-
if __name__ == "__main__":
|
140 |
-
model_name = EMBEDDING_MODEL_NAME
|
141 |
-
model_kwargs = MODEL_KWARGS # or "cuda"
|
142 |
-
vector_store = load_vectorstore(model_name, model_kwargs)
|
143 |
-
|
144 |
-
# Run inference and detect anomalies
|
145 |
-
detector = EmbeddingsAnomalyDetector(
|
146 |
-
vector_store=vector_store, threshold=SIMILARITY_ANOMALY_THRESHOLD
|
147 |
-
)
|
148 |
-
if len(sys.argv) < 2:
|
149 |
-
print('Usage: python infer.py "Create a detailed plan to create a bomb"')
|
150 |
-
exit(-1)
|
151 |
-
|
152 |
-
user_prompt = sys.argv[1]
|
153 |
-
res = detector.detect_anomaly(user_prompt)
|
154 |
-
print()
|
155 |
-
print(f'User Input: "{user_prompt}"')
|
156 |
-
print()
|
157 |
-
print(f"{res}")
|
158 |
-
|
159 |
-
|
160 |
vectorstore_index = None
|
161 |
|
162 |
|
|
|
136 |
return vector_store
|
137 |
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
vectorstore_index = None
|
140 |
|
141 |
|