PyTorchModelHubMixin: Bridging the Gap for Custom AI Models on Hugging Face
โข
12
self.brag():
Kokoro finally got 300 votes in
Pendrokar/TTS-Spaces-Arena after
@Pendrokar
was kind enough to add it 3 weeks ago.!pip install googlesearch-python requests
from googlesearch import search
import requests
query = "Glaucoma"
for url in search(f"{query} site:nih.gov filetype:pdf", 20):
if url.endswith(".pdf"):
with open(url.split("/")[-1], "wb") as f: f.write(requests.get(url).content)
print("โ
" + url.split("/")[-1])
print("Done!")
@cfahlgren1 I see you are a linkin park fan as well
huggingface.co/DIBT
is dead! diffusers
๐งจbistandbytes
as the official backend but using others like torchao
is already very simple. enable_model_cpu_offload()
from loadimg import load_img
from huggingface_hub import InferenceClient
# or load a local image
my_b64_img = load_img(imgPath_url_pillow_or_numpy ,output_type="base64" )
client = InferenceClient(api_key="hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
messages = [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Describe this image in one sentence."
},
{
"type": "image_url",
"image_url": {
"url": my_b64_img # base64 allows using images without uploading them to the web
}
}
]
}
]
stream = client.chat.completions.create(
model="meta-llama/Llama-3.2-11B-Vision-Instruct",
messages=messages,
max_tokens=500,
stream=True
)
for chunk in stream:
print(chunk.choices[0].delta.content, end="")