Make api-example-stream.py functional again

This commit is contained in:
oobabooga 2023-04-12 00:25:30 -03:00
parent 3850f13624
commit ff610b47d2

View File

@ -15,7 +15,7 @@ import websockets
# Note, Gradio may pick a different fn value as the definition of the Gradio app changes. # Note, Gradio may pick a different fn value as the definition of the Gradio app changes.
# You can always launch the web UI and inspect the websocket stream using your browser's dev tools # You can always launch the web UI and inspect the websocket stream using your browser's dev tools
# to determine what value Gradio expects here. # to determine what value Gradio expects here.
GRADIO_FN = 8 GRADIO_FN = 29
def random_hash(): def random_hash():
@ -41,6 +41,10 @@ async def run(context):
'length_penalty': 1, 'length_penalty': 1,
'early_stopping': False, 'early_stopping': False,
'seed': -1, 'seed': -1,
'add_bos_token': True,
'truncation_length': 2048,
'custom_stopping_strings': [],
'ban_eos_token': False
} }
payload = json.dumps([context, params]) payload = json.dumps([context, params])
session = random_hash() session = random_hash()