Spaces:
Runtime error
Runtime error
ffreemt
commited on
Commit
·
28743d9
1
Parent(s):
f1dfff2
Update some fixes
Browse files- app.py +12 -7
- okteto.yml +2 -2
app.py
CHANGED
|
@@ -236,8 +236,7 @@ def ingest(
|
|
| 236 |
for doc in documents
|
| 237 |
]
|
| 238 |
|
| 239 |
-
|
| 240 |
-
# TheBloke/vicuna-7B-1.1-GPTQ-4bit-128g
|
| 241 |
def gen_local_llm(model_id="TheBloke/vicuna-7B-1.1-HF"):
|
| 242 |
"""Gen a local llm.
|
| 243 |
|
|
@@ -334,13 +333,19 @@ def main():
|
|
| 334 |
def respond(message, chat_history):
|
| 335 |
# bot_message = random.choice(["How are you?", "I love you", "I'm very hungry"])
|
| 336 |
if ns.qa is None: # no files processed yet
|
| 337 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 338 |
|
| 339 |
-
res = ns.qa(message)
|
| 340 |
-
answer, docs = res["result"], res["source_documents"]
|
| 341 |
-
bot_message = f"{answer} ({docs})"
|
| 342 |
chat_history.append((message, bot_message))
|
| 343 |
-
|
| 344 |
return "", chat_history
|
| 345 |
|
| 346 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
|
|
|
| 236 |
for doc in documents
|
| 237 |
]
|
| 238 |
|
| 239 |
+
# https://huggingface.co/TheBloke/vicuna-7B-1.1-HF
|
|
|
|
| 240 |
def gen_local_llm(model_id="TheBloke/vicuna-7B-1.1-HF"):
|
| 241 |
"""Gen a local llm.
|
| 242 |
|
|
|
|
| 333 |
def respond(message, chat_history):
|
| 334 |
# bot_message = random.choice(["How are you?", "I love you", "I'm very hungry"])
|
| 335 |
if ns.qa is None: # no files processed yet
|
| 336 |
+
bot_message = "Provide some file(s) for processsing first."
|
| 337 |
+
chat_history.append((message, bot_message))
|
| 338 |
+
return "", chat_history
|
| 339 |
+
try:
|
| 340 |
+
res = ns.qa(message)
|
| 341 |
+
answer, docs = res["result"], res["source_documents"]
|
| 342 |
+
bot_message = f"{answer} ({docs})"
|
| 343 |
+
except Exception as exc:
|
| 344 |
+
logger.error(exc)
|
| 345 |
+
bot_message = f"{exc}"
|
| 346 |
|
|
|
|
|
|
|
|
|
|
| 347 |
chat_history.append((message, bot_message))
|
| 348 |
+
|
| 349 |
return "", chat_history
|
| 350 |
|
| 351 |
msg.submit(respond, [msg, chatbot], [msg, chatbot])
|
okteto.yml
CHANGED
|
@@ -36,8 +36,8 @@ dev:
|
|
| 36 |
environment:
|
| 37 |
- name=$USER
|
| 38 |
forward:
|
| 39 |
-
- 7861:7861
|
| 40 |
-
|
| 41 |
- 8501:8501
|
| 42 |
- 22:22
|
| 43 |
reverse:
|
|
|
|
| 36 |
environment:
|
| 37 |
- name=$USER
|
| 38 |
forward:
|
| 39 |
+
# - 7861:7861
|
| 40 |
+
- 7860:7860
|
| 41 |
- 8501:8501
|
| 42 |
- 22:22
|
| 43 |
reverse:
|