Spaces:
Sleeping
Sleeping
Update app.py
Browse files9 unmodified lines10111213141514 unmodified lines303132333435363738394041424344454647484950515253545556575859606162636465666768697071729 unmodified linesimport datetimeimport requests, jsonloop = asyncio.get_event_loop()# Monkey patchdef get_types(cls_set: List[Type], component: str):14 unmodified linesreturn docset, typesroutes.get_types = get_typesq = queue.Queue()arrr = []from huggingface_hub import hf_hub_downloadhf_hub_download(repo_id='StarFox7/Llama-2-ko-7B-chat-gguf', filename='Llama-2-ko-7B-chat-gguf-q4_0.bin', local_dir='./')# App codedef res(x, id, cdata, url):global qarr = [x, id, str(cdata.split(",", 1)[0]), url]q.put(arr)arrr.append(x)print("\n_Done\n\n")return "Done"def rese(x):print(f"{arrr}")return "Done"with gr.Blocks() as demo:count = 0aa = gr.Interface(fn=res,inputs=["text","text", "text", "text"],outputs="text",description="call",)bb = gr.Interface(fn=rese,inputs=["text"],outputs="text",description="call",)demo.queue(max_size=32).launch(enable_queue=True)9 unmodified lines10111213141516171814 unmodified lines333435363738394041424344454647484950515253545556579 unmodified linesimport datetimeimport requests, jsonfrom huggingface_hub import hf_hub_downloadfrom llama_cpp import Llamaloop = asyncio.get_event_loop()# Monkey patchdef get_types(cls_set: List[Type], component: str):14 unmodified linesreturn docset, typesroutes.get_types = get_typeshf_hub_download(repo_id='StarFox7/Llama-2-ko-7B-chat-gguf', filename='Llama-2-ko-7B-chat-gguf-q4_0.bin', local_dir='./')llm = Llama(model_path = 'Llama-2-ko-7B-chat-gguf-q4_0.bin',n_ctx=2048,)# App codedef res(x):output = llm(f"๋ค์์ A์ B์ ์ญํ ๊ทน์ด์ผ. ๋๋ B์ผ. A์ ๋ํํ๊ณ ์์ด. ์น๊ตฌ์๊ฒ ์น๊ทผํ๊ณ ๊ฐ๊ฒฐํ๊ฒ ์ ๋๋ตํด์ค.\n\n### A:\n{x}\n\n### B:\n", max_tokens=100, stop=["###"], echo=True)return output['choices'][0]['text']with gr.Blocks() as demo:count = 0aa = gr.Interface(fn=chat,inputs=["text"],outputs="text",description="call",)demo.queue(max_size=32).launch(enable_queue=True)
app.py+12-27