lollms/examples/simple_story/console.py
Saifeddine ALOUI b126999ed2 updated
2023-07-08 00:22:52 +02:00

23 lines
604 B
Python

from lollms.console import Conversation
import sys
class MyConversation(Conversation):
def __init__(self, cfg=None):
super().__init__(cfg, show_welcome_message=False)
def start_conversation(self):
prompt = "Once apon a time"
def callback(text, type=None):
print(text, end="")
sys.stdout = sys.__stdout__
sys.stdout.flush()
return True
print(prompt, end="")
sys.stdout = sys.__stdout__
sys.stdout.flush()
output = self.safe_generate(prompt, callback=callback)
if __name__ == '__main__':
cv = MyConversation()
cv.start_conversation()