Spaces:
Runtime error
Runtime error
ffreemt
commited on
Commit
·
acde6c9
1
Parent(s):
df81c3a
Update
Browse files
app.py
CHANGED
|
@@ -20,8 +20,22 @@ if os.environ.get("MOSAICML_API_KEY") is None:
|
|
| 20 |
# """
|
| 21 |
|
| 22 |
|
| 23 |
-
def
|
| 24 |
-
logger.debug(f"{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
|
| 27 |
def download_mpt_quant(destination_folder: str, repo_id: str, model_filename: str):
|
|
@@ -284,6 +298,7 @@ with gr.Blocks(
|
|
| 284 |
elem_classes=["disclaimer"],
|
| 285 |
)
|
| 286 |
|
|
|
|
| 287 |
submit_event = msg.submit(
|
| 288 |
fn=conversation.user_turn,
|
| 289 |
inputs=[msg, chatbot],
|
|
@@ -301,11 +316,13 @@ with gr.Blocks(
|
|
| 301 |
outputs=[msg, chatbot],
|
| 302 |
queue=False,
|
| 303 |
).then(
|
| 304 |
-
fn=conversation.bot_turn,
|
| 305 |
inputs=[system, chatbot],
|
| 306 |
outputs=[msg, chatbot],
|
| 307 |
queue=True,
|
| 308 |
)
|
|
|
|
|
|
|
| 309 |
stop.click(
|
| 310 |
fn=None,
|
| 311 |
inputs=None,
|
|
|
|
| 20 |
# """
|
| 21 |
|
| 22 |
|
| 23 |
+
def predict0(prompt, bot, timeout):
|
| 24 |
+
logger.debug(f"{prompt=}, {bot=}, {timeout=}")
|
| 25 |
+
try:
|
| 26 |
+
user_prompt = prompt
|
| 27 |
+
generator = generate(llm, generation_config, system_prompt, user_prompt.strip())
|
| 28 |
+
print(assistant_prefix, end=" ", flush=True)
|
| 29 |
+
for word in generator:
|
| 30 |
+
print(word, end="", flush=True)
|
| 31 |
+
print("")
|
| 32 |
+
response = word
|
| 33 |
+
except Exception as exc:
|
| 34 |
+
logger.error(exc)
|
| 35 |
+
response = f"{exc=}"
|
| 36 |
+
bot = {"inputs": [response]}
|
| 37 |
+
|
| 38 |
+
return prompt, bot
|
| 39 |
|
| 40 |
|
| 41 |
def download_mpt_quant(destination_folder: str, repo_id: str, model_filename: str):
|
|
|
|
| 298 |
elem_classes=["disclaimer"],
|
| 299 |
)
|
| 300 |
|
| 301 |
+
# _ = """
|
| 302 |
submit_event = msg.submit(
|
| 303 |
fn=conversation.user_turn,
|
| 304 |
inputs=[msg, chatbot],
|
|
|
|
| 316 |
outputs=[msg, chatbot],
|
| 317 |
queue=False,
|
| 318 |
).then(
|
| 319 |
+
# fn=conversation.bot_turn,
|
| 320 |
inputs=[system, chatbot],
|
| 321 |
outputs=[msg, chatbot],
|
| 322 |
queue=True,
|
| 323 |
)
|
| 324 |
+
# """
|
| 325 |
+
|
| 326 |
stop.click(
|
| 327 |
fn=None,
|
| 328 |
inputs=None,
|