Astrid-1B-UI / app.py
Stevross's picture
Create app.py
56f3ab6
raw
history blame
793 Bytes
import streamlit as st
from transformers import pipeline
# Initialize the model and tokenizer for CPU
generate_text = pipeline(
model="PAIXAI/Astrid-1B",
torch_dtype="auto",
trust_remote_code=True,
use_fast=True
)
# Streamlit UI
st.title("Astrid-1B Chatbot")
st.write("Test the Astrid-1B chatbot from Hugging Face!")
user_input = st.text_input("Enter your question:")
if user_input:
response = generate_text(user_input, min_new_tokens=2, max_new_tokens=256, do_sample=False, num_beams=1, temperature=0.3, repetition_penalty=1.2, renormalize_logits=True)
st.write("Response:", response[0]["generated_text"])
st.write("Note: This is a simple UI for demonstration purposes. Ensure you have the required libraries installed and adjust the model parameters as needed.")