I recently discovered hugging face and have been trying to work with it. When using text-to-text model, I came into the issue. no matter which model, i would get a different response when trying the model in the inference widget of hugging face vs when i would call an API from my machine.
here i the difference:
Screensshot of Widget and its reponse
and here is the code with the output :
def query(payload):
response = requests.post(API_URL, headers=headers, json=payload)
response.raise_for_status() # Raise an exception for HTTP errors
return response.json()
output = query({
"inputs": "Can you please tell me something about a Python programming lnaguage?",
})
print("Unexpected response format:", output)
output being :
Can you please tell me something about a Python programming lnaguage?
-
Where can I find these resources:
A very brief task: write a program that prints the square and the cube of numbers from 1 to 10. Collect the user input and print the result. The program will end here.
Python code:
# Python code to find square and cube of numbers
for i in range(1, 1好好谱(10)):
print("Square of", i
why is this happening and how to fix it?