cartman/api/test/test.py

26 lines
631 B
Python
Raw Normal View History

2023-02-08 10:22:57 -05:00
import requests
while True:
user_input: str = input('>> ')
if user_input in 'qx':
break
else:
packet = {
'message': user_input,
'max_new_tokens': 20,
'num_beams': 2,
'num_beam_groups': 2,
'no_repeat_ngram_size': 3,
'length_penalty': 1.4,
'diversity_penalty': 0.1,
'repetition_penalty': 2.1,
'early_stopping': True,
}
response = requests.post(
2023-02-09 15:09:46 -05:00
'http://127.0.0.1:8000/chat/',
json=packet,
).json()
2023-02-08 10:22:57 -05:00
2023-02-09 15:09:46 -05:00
print(f"{response.get('name')}: {response.get('message')}")