Access using api
#32
by
ludovicop
- opened
Hey, i'm trying to access the model using API or any sort of request. I'm currently hosting via runpod.
Any idea and\or documentation on how to access the model using an api or request instead of the web graphic interface.
I've used this python script but i'm only getting an empty response
import requests
import json
Definisci qui il tuo pod_id
pod_id = "qwerty1234"
Definisci qui il tuo input
user_input = "What is Deep Learning?"
URL dell'API
url = f"https://{pod_id}-8080.proxy.runpod.net/generate"
Dati da inviare
data = {
"inputs": user_input,
"parameters": {"max_new_tokens": 40}
}
Imposta l'header per indicare che stiamo inviando dati JSON
headers = {'Content-Type': 'application/json'}
Esegui la richiesta POST
response = requests.post(url, data=json.dumps(data), headers=headers)
Stampa la risposta
print(response.text)