File size: 731 Bytes
099ae28 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
import streamlit as st
from transformers import pipeline
# Load the Hugging Face model
model_name = "adeel300/QA_T5_small"
nlp = pipeline("text-generation", model=model_name)
# Streamlit app
st.title("Hugging Face Model Inference")
st.write("Enter your text below and get the model's response.")
# Input text
input_text = st.text_area("Input Text", value="", height=200)
if st.button("Generate Response"):
if input_text:
with st.spinner("Generating response..."):
response = nlp(input_text)
st.success("Response generated!")
st.text_area("Response", value=response[0]['generated_text'], height=200)
else:
st.warning("Please enter some text to generate a response.")
|