Spaces:
Sleeping
Sleeping
Update app.py
Browse files9 unmodified lines10111213141516171814 unmodified lines333435333435363738363738394041424344454647484950424344455253545546474849606162636465666750515253545556579 unmodified linesimport datetimeimport requests, json
from huggingface_hub import hf_hub_downloadfrom llama_cpp import Llama
loop = asyncio.get_event_loop()# Monkey patchdef get_types(cls_set: List[Type], component: str):14 unmodified lines return docset, typesroutes.get_types = get_types
q = 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='./')
llm = Llama(model_path = 'Llama-2-ko-7B-chat-gguf-q4_0.bin', n_ctx=2048, )# App codedef res(x, id, cdata, url): global q
arr = [x, id, str(cdata.split(",", 1)[0]), url] q.put(arr)
arrr.append(x) print("\n_Done\n\n") return "Done"def 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']
def rese(x):
print(f"{arrr}") return "Done" with gr.Blocks() as demo: count = 0 aa = gr.Interface( fn=res, inputs=["text","text", "text", "text"], outputs="text", description="call", )
bb = gr.Interface( fn=rese, fn=chat, inputs=["text"], outputs="text", description="call", )
demo.queue(max_size=32).launch(enable_queue=True)app.py+12-27