ldhldh commited on
Commit
9e16fe0
β€’
1 Parent(s): 98e337c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +64 -9
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)