123Chr1s commited on
Commit
ca0b264
·
verified ·
1 Parent(s): 4c9221a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Load the question-answering pipeline
5
+ qa_pipeline = pipeline("question-answering", model="ilsp/Meltemi-7B-v1.5")
6
+
7
+ # Title of the app
8
+ st.title("Question Answering with Meltemi-7B")
9
+
10
+ # Input fields for context and question
11
+ context = st.text_area("Context", "Provide the context here...")
12
+ question = st.text_input("Question", "Ask your question here...")
13
+
14
+ # Generate answer when the user presses the button
15
+ if st.button("Get Answer"):
16
+ if context and question:
17
+ result = qa_pipeline(question=question, context=context)
18
+ st.write(f"Answer: {result['answer']}")
19
+ else:
20
+ st.write("Please provide both context and a question.")