Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,6 @@
|
|
| 1 |
from fastapi import FastAPI, HTTPException, Request
|
| 2 |
from fastapi.responses import StreamingResponse
|
| 3 |
from llama_cpp import Llama
|
| 4 |
-
import time
|
| 5 |
-
import os
|
| 6 |
|
| 7 |
app = FastAPI()
|
| 8 |
|
|
@@ -16,7 +14,6 @@ def generate_output_stream(prompt):
|
|
| 16 |
if chunk.get('choices') and chunk['choices'][0].get('text'):
|
| 17 |
text = chunk['choices'][0]['text']
|
| 18 |
yield f"{text}\n"
|
| 19 |
-
time.sleep(0.01) # Adjust the delay if needed
|
| 20 |
except StopIteration:
|
| 21 |
break
|
| 22 |
|
|
|
|
| 1 |
from fastapi import FastAPI, HTTPException, Request
|
| 2 |
from fastapi.responses import StreamingResponse
|
| 3 |
from llama_cpp import Llama
|
|
|
|
|
|
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
|
|
|
| 14 |
if chunk.get('choices') and chunk['choices'][0].get('text'):
|
| 15 |
text = chunk['choices'][0]['text']
|
| 16 |
yield f"{text}\n"
|
|
|
|
| 17 |
except StopIteration:
|
| 18 |
break
|
| 19 |
|