Spaces:
Build error
Build error
Joseph commited on
Commit ·
1de5e4f
1
Parent(s): 2c2e98e
Update gradio_app.py
Browse files1234524 unmodified lines30313233343522 unmodified lines5859606162636465666768# Importing librariesfrom llama_cpp import Llamaimport gradio as grimport psutil24 unmodified linessystem_message = f.read()def generate_answer(request: str, max_tokens: int = 256, custom_prompt: str = None):logs = f"Request: {request}\nMax tokens: {max_tokens}\nCustom prompt: {custom_prompt}\n"try:maxTokens = max_tokens if 16 <= max_tokens <= 256 else 6422 unmodified linestext = "Sorry, but something went wrong while generating answer. Try again or fix code. If you are maintainer of this space, look into logs."logs += f"\nFinal: '''{text}'''"return text, logsexcept Exception as e:print(e)return "Oops! Internal server error. Check the logs of space/instance.", logsprint("\n\n\n")print("! LOAD GRADIO INTERFACE !")demo = gr.Interface(12345624 unmodified lines3132333435363722 unmodified lines606162636465666768697071# Importing librariesfrom llama_cpp import Llamafrom time import timeimport gradio as grimport psutil24 unmodified linessystem_message = f.read()def generate_answer(request: str, max_tokens: int = 256, custom_prompt: str = None):t0 = time()logs = f"Request: {request}\nMax tokens: {max_tokens}\nCustom prompt: {custom_prompt}\n"try:maxTokens = max_tokens if 16 <= max_tokens <= 256 else 6422 unmodified linestext = "Sorry, but something went wrong while generating answer. Try again or fix code. If you are maintainer of this space, look into logs."logs += f"\nFinal: '''{text}'''"logs += f"\n\nTime spent: {time()-t0}"return text, logsexcept Exception as e:logs += str(e)logs += f"\n\nTime spent: {time()-t0}"return "Oops! Internal server error. Check the logs of space/instance.", logsprint("! LOAD GRADIO INTERFACE !")demo = gr.Interface(
gradio_app.py+5-2