Spaces:
Sleeping
Sleeping
vtrv.vls
commited on
Commit
·
cc225d4
1
Parent(s):
7af330f
Async requests
Browse files
app.py
CHANGED
@@ -39,7 +39,7 @@ async def model_gen(
|
|
39 |
|
40 |
chat_history = [] if no_context else chat_history
|
41 |
|
42 |
-
|
43 |
content,
|
44 |
chat_history,
|
45 |
S3_SESSION,
|
@@ -49,6 +49,8 @@ async def model_gen(
|
|
49 |
{"top_p": top_p, "temperature": temp, "max_tokens": max_tokens}
|
50 |
)
|
51 |
|
|
|
|
|
52 |
async def model_regen(
|
53 |
content,
|
54 |
chat_history,
|
@@ -67,7 +69,7 @@ async def model_regen(
|
|
67 |
chat_history = chat_history[-1] if no_context else chat_history
|
68 |
content = copy(chat_history[-1][0])
|
69 |
|
70 |
-
|
71 |
content,
|
72 |
chat_history[:-1],
|
73 |
S3_SESSION,
|
@@ -77,6 +79,8 @@ async def model_regen(
|
|
77 |
{"top_p": top_p, "temperature": temp, "max_tokens": max_tokens}
|
78 |
)
|
79 |
|
|
|
|
|
80 |
def model_manager(
|
81 |
add_model,
|
82 |
model_lib,
|
|
|
39 |
|
40 |
chat_history = [] if no_context else chat_history
|
41 |
|
42 |
+
res = await model_response(
|
43 |
content,
|
44 |
chat_history,
|
45 |
S3_SESSION,
|
|
|
49 |
{"top_p": top_p, "temperature": temp, "max_tokens": max_tokens}
|
50 |
)
|
51 |
|
52 |
+
return res
|
53 |
+
|
54 |
async def model_regen(
|
55 |
content,
|
56 |
chat_history,
|
|
|
69 |
chat_history = chat_history[-1] if no_context else chat_history
|
70 |
content = copy(chat_history[-1][0])
|
71 |
|
72 |
+
res = await model_response(
|
73 |
content,
|
74 |
chat_history[:-1],
|
75 |
S3_SESSION,
|
|
|
79 |
{"top_p": top_p, "temperature": temp, "max_tokens": max_tokens}
|
80 |
)
|
81 |
|
82 |
+
return res
|
83 |
+
|
84 |
def model_manager(
|
85 |
add_model,
|
86 |
model_lib,
|
utils.py
CHANGED
@@ -7,7 +7,7 @@ from copy import copy
|
|
7 |
def clear_chat():
|
8 |
return '', []
|
9 |
|
10 |
-
def model_response(
|
11 |
content,
|
12 |
chat_history,
|
13 |
s3_session,
|
|
|
7 |
def clear_chat():
|
8 |
return '', []
|
9 |
|
10 |
+
async def model_response(
|
11 |
content,
|
12 |
chat_history,
|
13 |
s3_session,
|