Spaces:
Sleeping
Sleeping
File size: 692 Bytes
37f0bc6 0d1693b 9a74ca9 37f0bc6 9a74ca9 204e114 37f0bc6 204e114 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import streamlit as st
from transformers import pipeline
import torch
import os
from huggingface_hub import login
login(token = os.getenv('HF_TOKEN'))
pipe = pipeline("text-generation", model="google/gemma-3-1b-it", torch_dtype=torch.bfloat16)
txt = st.text_area("Test this")
if (txt):
messages = [
[
{
"role": "system",
"content": [{"type": "text", "text": "You are a helpful assistant."},]
},
{
"role": "user",
"content": [{"type": "text", "text": "Write a poem on Hugging Face, the company"},]
},
],
]
st.write(pipe(messages, max_new_tokens=50)) |