Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
qa_pipeline = pipeline("text-generation", model="EleutherAI/gpt-neo-125m")
|
| 5 |
+
|
| 6 |
+
st.title("GPT-Neo 125M Q&A App")
|
| 7 |
+
|
| 8 |
+
# User input
|
| 9 |
+
user_question = st.text_input("Ask a question:")
|
| 10 |
+
|
| 11 |
+
# Generate answer
|
| 12 |
+
if user_question:
|
| 13 |
+
response = qa_pipeline(user_question, max_length=50)
|
| 14 |
+
answer = response[0]['generated_text']
|
| 15 |
+
st.write(answer)
|