alyliann's picture
Update app.py
8913c56 verified
raw
history blame
435 Bytes
import os
import streamlit as st
from huggingface_hub import InferenceClient
client = InferenceClient(api_key=os.environ['HF_KEY'])
messages = [
{
"role": "user",
"content": "What is the capital of France?"
}
]
stream = client.chat.completions.create(
model="HuggingFaceTB/SmolLM2-1.7B-Instruct",
messages=messages,
max_tokens=500,
stream=True
)
for chunk in stream:
print(chunk.choices[0].delta.content, end="")