Stevross commited on
Commit
56f3ab6
·
1 Parent(s): a4e5018

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Initialize the model and tokenizer for CPU
5
+ generate_text = pipeline(
6
+ model="PAIXAI/Astrid-1B",
7
+ torch_dtype="auto",
8
+ trust_remote_code=True,
9
+ use_fast=True
10
+ )
11
+
12
+ # Streamlit UI
13
+ st.title("Astrid-1B Chatbot")
14
+ st.write("Test the Astrid-1B chatbot from Hugging Face!")
15
+
16
+ user_input = st.text_input("Enter your question:")
17
+ if user_input:
18
+ 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)
19
+ st.write("Response:", response[0]["generated_text"])
20
+
21
+ 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.")