Spaces:
Runtime error
Runtime error
Update app.py
Browse files132 unmodified lines133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168135 unmodified lines304305306307308309310311312313314315316132 unmodified lines**prompt_kwargs,):print(seed)timestamp=datetime.datetime.now()generate_kwargs = dict(temperature=0.9,max_new_tokens=max_tokens,top_p=0.95,repetition_penalty=1.0,do_sample=True,seed=seed,)content = prompt_template.format(**prompt_kwargs)#if VERBOSE:print(LOG_PROMPT.format(content))#formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)#formatted_prompt = format_prompt(f'{content}', history)stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)resp = ""for response in stream:resp += response.token.text#yield resp#if VERBOSE:print(LOG_RESPONSE.format(resp))return respdef run_gpt(prompt_template,stop_tokens,135 unmodified linestry:resp = run_gpt_no_prefix(GET_CHART,stop_tokens=["observation:", "task:", "action:", "thought:"],max_tokens=8192,seed=seed,inp=inp,).strip("\n")print(resp)except Exception as e:resp = ereturn respdef summarize(inp,history,report_check,chart_check,data=None,files=None,url=None,pdf_url=None,pdf_batch=None):132 unmodified lines133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168135 unmodified lines304305306307308309310311312313314315316317132 unmodified lines**prompt_kwargs,):print(seed)try:generate_kwargs = dict(temperature=0.9,max_new_tokens=max_tokens,top_p=0.95,repetition_penalty=1.0,do_sample=True,seed=seed,)content = prompt_template.format(**prompt_kwargs)#if VERBOSE:print(LOG_PROMPT.format(content))#formatted_prompt = format_prompt(f"{system_prompt}, {prompt}", history)#formatted_prompt = format_prompt(f'{content}', history)stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)resp = ""for response in stream:resp += response.token.text#yield resp#if VERBOSE:print(LOG_RESPONSE.format(resp))return respexcept Exception as e:print(f'no_prefix_error:: {e}')return "Error"def run_gpt(prompt_template,stop_tokens,135 unmodified linestry:resp = run_gpt_no_prefix(GET_CHART,stop_tokens=[],max_tokens=8192,seed=seed,inp=inp,).strip("\n")print(resp)except Exception as e:print(f'Error:: {e}')resp = ereturn respdef summarize(inp,history,report_check,chart_check,data=None,files=None,url=None,pdf_url=None,pdf_batch=None):
app.py+30-29