Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
|
|
|
|
|
| 1 |
from transformers import pipeline
|
| 2 |
|
| 3 |
import streamlit as st
|
| 4 |
|
| 5 |
|
| 6 |
def get_openai_response(question):
|
| 7 |
-
# llm = OpenAI(
|
| 8 |
-
# openai_api_key=os.getenv("OPEN_API_KEY"),
|
| 9 |
-
# model_name="gpt-3.5-turbo-instruct",
|
| 10 |
-
# temperature=0.6,
|
| 11 |
-
# )
|
| 12 |
response = pipeline("summarization", model="stevhliu/my_awesome_billsum_model")
|
| 13 |
-
# response = llm(question)
|
| 14 |
return response
|
| 15 |
-
|
| 16 |
|
| 17 |
|
| 18 |
## streamlit app
|
|
@@ -23,9 +19,13 @@ st.write("UPDATE: This app uses the 'gpt-3.5-turbo-instruct' model through Langc
|
|
| 23 |
|
| 24 |
|
| 25 |
# input = st.text_input("Enter your query: ", key=input)
|
| 26 |
-
|
|
|
|
|
|
|
| 27 |
if uploaded_file is not None:
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
response = get_openai_response(df)
|
| 30 |
|
| 31 |
|
|
|
|
| 1 |
+
import pdfminer
|
| 2 |
+
from pdfminer.high_level import extract_pages
|
| 3 |
from transformers import pipeline
|
| 4 |
|
| 5 |
import streamlit as st
|
| 6 |
|
| 7 |
|
| 8 |
def get_openai_response(question):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
response = pipeline("summarization", model="stevhliu/my_awesome_billsum_model")
|
|
|
|
| 10 |
return response
|
| 11 |
+
|
| 12 |
|
| 13 |
|
| 14 |
## streamlit app
|
|
|
|
| 19 |
|
| 20 |
|
| 21 |
# input = st.text_input("Enter your query: ", key=input)
|
| 22 |
+
st.write(pdfminer.__version__)
|
| 23 |
+
|
| 24 |
+
uploaded_file = st.file_uploader("Choose a file", "pdf")
|
| 25 |
if uploaded_file is not None:
|
| 26 |
+
for page_layout in extract_pages(uploaded_file):
|
| 27 |
+
for element in page_layout:
|
| 28 |
+
st.write(element)
|
| 29 |
response = get_openai_response(df)
|
| 30 |
|
| 31 |
|