Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,18 +33,46 @@ def get_types(cls_set: List[Type], component: str):
|
|
| 33 |
return docset, types
|
| 34 |
routes.get_types = get_types
|
| 35 |
|
| 36 |
-
hf_hub_download(repo_id='StarFox7/Llama-2-ko-7B-chat-gguf', filename='Llama-2-ko-7B-chat-gguf-q4_0.bin', local_dir='./')
|
| 37 |
-
|
| 38 |
-
llm = Llama(model_path = 'Llama-2-ko-7B-chat-gguf-q4_0.bin',
|
| 39 |
-
n_ctx=512,
|
| 40 |
-
)
|
| 41 |
# App code
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
def chat(x):
|
| 43 |
-
#prom = f"λ€μμ Aμ Bμ μν κ·Ήμ΄μΌ. λλ BμΌ. Aμ λννκ³ μμ΄. μΉκ΅¬μκ² μΉκ·Όνκ³ κ°κ²°νκ² μ λλ΅ν΄μ€.\n\n### A:\n{x}\n\n### B:\n"
|
| 44 |
-
#output = llm(prom, max_tokens=20, stop=["###"], echo=True)
|
| 45 |
-
#return output['choices'][0]['text'][len(prom):-1]
|
| 46 |
-
return "AI μλ΅μ
λλ€."
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
with gr.Blocks() as demo:
|
| 49 |
count = 0
|
| 50 |
aa = gr.Interface(
|
|
@@ -54,5 +82,32 @@ with gr.Blocks() as demo:
|
|
| 54 |
description="call",
|
| 55 |
)
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
demo.queue(max_size=32).launch(enable_queue=True)
|
|
|
|
| 33 |
return docset, types
|
| 34 |
routes.get_types = get_types
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
# App code
|
| 37 |
+
|
| 38 |
+
account_list = dict()
|
| 39 |
+
|
| 40 |
+
account_list['id'] = "pass"
|
| 41 |
+
|
| 42 |
+
name_list = dict()
|
| 43 |
+
name_list['id'] = 'name'
|
| 44 |
+
|
| 45 |
def chat(x):
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
return "AI μλ΅μ
λλ€."
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
def register(id, pass):
|
| 51 |
+
if id in account_list:
|
| 52 |
+
return "exist"
|
| 53 |
+
else:
|
| 54 |
+
account_list[id] = pass
|
| 55 |
+
return "ok"
|
| 56 |
+
|
| 57 |
+
def login(id, pass):
|
| 58 |
+
if id in account_list:
|
| 59 |
+
if account_list[id] == pass:
|
| 60 |
+
return "login"
|
| 61 |
+
else:
|
| 62 |
+
return "password error"
|
| 63 |
+
else:
|
| 64 |
+
return "no id"
|
| 65 |
+
|
| 66 |
+
def add_name(id, name):
|
| 67 |
+
name_list[id] = name
|
| 68 |
+
return "ok"
|
| 69 |
+
|
| 70 |
+
def get_name(id):
|
| 71 |
+
if id in name_list:
|
| 72 |
+
return name_list['id']
|
| 73 |
+
else:
|
| 74 |
+
return "no id"
|
| 75 |
+
|
| 76 |
with gr.Blocks() as demo:
|
| 77 |
count = 0
|
| 78 |
aa = gr.Interface(
|
|
|
|
| 82 |
description="call",
|
| 83 |
)
|
| 84 |
|
| 85 |
+
rr = gr.Interface(
|
| 86 |
+
fn=register,
|
| 87 |
+
inputs=["text", "text"],
|
| 88 |
+
outputs="text",
|
| 89 |
+
description="call",
|
| 90 |
+
)
|
| 91 |
+
|
| 92 |
+
ll = gr.Interface(
|
| 93 |
+
fn=login,
|
| 94 |
+
inputs=["text", "text"],
|
| 95 |
+
outputs="text",
|
| 96 |
+
description="call",
|
| 97 |
+
)
|
| 98 |
|
| 99 |
+
ad = gr.Interface(
|
| 100 |
+
fn=add_name,
|
| 101 |
+
inputs=["text", "text"],
|
| 102 |
+
outputs="text",
|
| 103 |
+
description="call",
|
| 104 |
+
)
|
| 105 |
+
|
| 106 |
+
nn = gr.Interface(
|
| 107 |
+
fn=get_name,
|
| 108 |
+
inputs=["text"],
|
| 109 |
+
outputs="text",
|
| 110 |
+
description="call",
|
| 111 |
+
)
|
| 112 |
+
|
| 113 |
demo.queue(max_size=32).launch(enable_queue=True)
|