Spaces:
Sleeping
Sleeping
Update pipeline.py
Browse files- pipeline.py +4 -2
pipeline.py
CHANGED
|
@@ -200,9 +200,11 @@ async def run_async_pipeline(query: str) -> str:
|
|
| 200 |
return final_refusal.strip()
|
| 201 |
|
| 202 |
# Run the pipeline with the event loop
|
|
|
|
|
|
|
| 203 |
def run_with_chain(query: str) -> str:
|
| 204 |
-
|
| 205 |
-
return
|
| 206 |
|
| 207 |
# Initialize chains here
|
| 208 |
classification_chain = get_classification_chain()
|
|
|
|
| 200 |
return final_refusal.strip()
|
| 201 |
|
| 202 |
# Run the pipeline with the event loop
|
| 203 |
+
import asyncio
|
| 204 |
+
|
| 205 |
def run_with_chain(query: str) -> str:
|
| 206 |
+
# Use asyncio.run to run the async pipeline, which ensures a fresh event loop
|
| 207 |
+
return asyncio.run(run_async_pipeline(query))
|
| 208 |
|
| 209 |
# Initialize chains here
|
| 210 |
classification_chain = get_classification_chain()
|