Reformat everything

This commit is contained in:
oobabooga
2023-04-07 00:08:46 -03:00
parent 848c4edfd5
commit 01cacfc14f
29 changed files with 334 additions and 193 deletions

View File

@@ -17,6 +17,7 @@ def random_hash():
letters = string.ascii_lowercase + string.digits
return ''.join(random.choice(letters) for i in range(9))
async def run(context):
server = "127.0.0.1"
params = {
@@ -41,7 +42,7 @@ async def run(context):
async with websockets.connect(f"ws://{server}:7860/queue/join") as websocket:
while content := json.loads(await websocket.recv()):
#Python3.10 syntax, replace with if elif on older
# Python3.10 syntax, replace with if elif on older
match content["msg"]:
case "send_hash":
await websocket.send(json.dumps({
@@ -62,13 +63,14 @@ async def run(context):
pass
case "process_generating" | "process_completed":
yield content["output"]["data"][0]
# You can search for your desired end indicator and
# You can search for your desired end indicator and
# stop generation by closing the websocket here
if (content["msg"] == "process_completed"):
break
prompt = "What I would like to say is the following: "
async def get_result():
async for response in run(prompt):
# Print intermediate steps