Spaces:
Build error
Build error
Samuel L Meyers
commited on
Commit
·
b424c57
1
Parent(s):
320c4ed
use JSON
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import torch
|
|
| 7 |
from conversation import get_default_conv_template
|
| 8 |
import gradio as gr
|
| 9 |
from llama_cpp import Llama
|
| 10 |
-
import
|
| 11 |
|
| 12 |
"""
|
| 13 |
|
|
@@ -39,7 +39,8 @@ def m3b_talk(text):
|
|
| 39 |
|
| 40 |
for token in lcpp_model(formattedQuery, stop=["[|User|]", "\n"], echo=True):
|
| 41 |
resp += token
|
| 42 |
-
|
|
|
|
| 43 |
return answer
|
| 44 |
|
| 45 |
def main():
|
|
|
|
| 7 |
from conversation import get_default_conv_template
|
| 8 |
import gradio as gr
|
| 9 |
from llama_cpp import Llama
|
| 10 |
+
import json
|
| 11 |
|
| 12 |
"""
|
| 13 |
|
|
|
|
| 39 |
|
| 40 |
for token in lcpp_model(formattedQuery, stop=["[|User|]", "\n"], echo=True):
|
| 41 |
resp += token
|
| 42 |
+
jsn = json.loads(resp)
|
| 43 |
+
answer = jsn["choices"][0]["text"].replace(formattedQuery, "")
|
| 44 |
return answer
|
| 45 |
|
| 46 |
def main():
|