QA_T5 / app.py
adeel300's picture
Create app.py
099ae28 verified
raw
history blame contribute delete
731 Bytes
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.")