Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -56,7 +56,7 @@ async def brave_search(query, count=1):
|
|
56 |
|
57 |
|
58 |
|
59 |
-
pipeline_lock = asyncio.Lock()
|
60 |
|
61 |
@traceable
|
62 |
@log_time
|
@@ -64,10 +64,10 @@ async def query_teapot(prompt, context, user_input):
|
|
64 |
input_text = prompt + "\n" + context + "\n" + user_input
|
65 |
inputs = tokenizer(input_text, return_tensors="pt")
|
66 |
|
67 |
-
async with pipeline_lock: # Ensure only one call runs at a time
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
|
72 |
|
73 |
@log_time
|
|
|
56 |
|
57 |
|
58 |
|
59 |
+
# pipeline_lock = asyncio.Lock()
|
60 |
|
61 |
@traceable
|
62 |
@log_time
|
|
|
64 |
input_text = prompt + "\n" + context + "\n" + user_input
|
65 |
inputs = tokenizer(input_text, return_tensors="pt")
|
66 |
|
67 |
+
# async with pipeline_lock: # Ensure only one call runs at a time
|
68 |
+
output = await asyncio.to_thread(model.generate, **inputs, max_new_tokens=512)
|
69 |
+
output_text = tokenizer.decode(output[0], skip_special_tokens=True)
|
70 |
+
return output_text
|
71 |
|
72 |
|
73 |
@log_time
|