Spaces:
Runtime error
Runtime error
File size: 623 Bytes
acaca81 caa0347 acaca81 caa0347 399203a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
input_ids = tokenizer.encode(input_text + " >> User: ", return_tensors='pt')
generated_output = model.generate(input_ids, max_length=100, num_return_sequences=1)
response = tokenizer.decode(generated_output[:, input_ids.shape[-1]:][0], skip_special_tokens=True)
return response
iface = gr.Interface(
fn=generate_response,
inputs='text',
outputs='text',
layout='vertical',
title='ChatGPT',
description='A simple chatbot powered by ChatGPT',
article= 'https://huggingface.co/models',
examples=[['Hello'], ['How are you?'], ['What is your name?']],
)
iface.launch(share=True)
|