Browse Source

Update cli demo

visualglm
duzx16 2 years ago
parent
commit
eb86299755
  1. 11
      cli_demo_vision.py

11
cli_demo_vision.py

@ -1,6 +1,8 @@
import os import os
import platform import platform
import signal import signal
import sys
from transformers import AutoTokenizer, AutoModel from transformers import AutoTokenizer, AutoModel
import readline import readline
@ -52,13 +54,10 @@ def main():
os.system(clear_command) os.system(clear_command)
print(build_prompt(history, prefix), flush=True) print(build_prompt(history, prefix), flush=True)
query = input("\n用户:") query = input("\n用户:")
if query.strip() == "stop":
break
if query.strip() == "clear": if query.strip() == "clear":
history = [] break
os.system(clear_command) if query.strip() == "stop":
print(prefix) sys.exit(0)
continue
if __name__ == "__main__": if __name__ == "__main__":

Loading…
Cancel
Save