Refactor several function calls and the API
This commit is contained in:
parent
378d21e80c
commit
3f3e42e26c
8 changed files with 147 additions and 118 deletions
|
@ -10,6 +10,8 @@ Optionally, you can also add the --share flag to generate a public gradio URL,
|
|||
allowing you to use the API remotely.
|
||||
|
||||
'''
|
||||
import json
|
||||
|
||||
import requests
|
||||
|
||||
# Server address
|
||||
|
@ -38,24 +40,11 @@ params = {
|
|||
# Input prompt
|
||||
prompt = "What I would like to say is the following: "
|
||||
|
||||
payload = json.dumps([prompt, params])
|
||||
|
||||
response = requests.post(f"http://{server}:7860/run/textgen", json={
|
||||
"data": [
|
||||
prompt,
|
||||
params['max_new_tokens'],
|
||||
params['do_sample'],
|
||||
params['temperature'],
|
||||
params['top_p'],
|
||||
params['typical_p'],
|
||||
params['repetition_penalty'],
|
||||
params['encoder_repetition_penalty'],
|
||||
params['top_k'],
|
||||
params['min_length'],
|
||||
params['no_repeat_ngram_size'],
|
||||
params['num_beams'],
|
||||
params['penalty_alpha'],
|
||||
params['length_penalty'],
|
||||
params['early_stopping'],
|
||||
params['seed'],
|
||||
payload
|
||||
]
|
||||
}).json()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue