Spaces:
Sleeping
Sleeping
File size: 792 Bytes
37e09fd 5ae2925 37e09fd 5ae2925 37e09fd 5ae2925 37e09fd 5ae2925 |
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 27 28 |
import streamlit as st
from transformers import pipeline
# Load the model
qa_pipeline = pipeline("text-generation", model="EleutherAI/gpt-neo-125m")
# Streamlit interface
st.title("GPT-Neo 125M Q&A App")
# Example questions
example_questions = [
"Who is Spider-Man?",
"Who is Venom?",
"Who is OpenAI?",
"Who is Rocket Raccoon?"
]
st.subheader("Select an example question or type your own:")
selected_question = st.selectbox("Choose an example question", example_questions)
user_question = st.text_input("Or ask your own question:", value=selected_question)
# Generate answer
if user_question:
with st.spinner('Generating answer...'):
response = qa_pipeline(user_question, max_length=50)
answer = response[0]['generated_text']
st.write(answer)
|