File size: 683 Bytes
7a89bde
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st

import requests

# from studybot import qa_chain
# st.write(qa_chain)

upload_pdf = st.file_uploader("Upload PDF", type="pdf")
if upload_pdf is not None:
    files = {"file": upload_pdf}
    response = requests.post(
        "https://hemanthsai7-studybotapi.hf.space/api/upload", files=files
    )
    st.write(response)

query = st.text_input("Question", key="question")
st.write(st.session_state)

if st.button("Ask"):
    # answer = qa_chain(query)
    answer = requests.post(
        "https://hemanthsai7-studybotapi.hf.space/api/inference",
        json={"promptMessage": query},
    ).json()
    st.write(answer)
    # st.session_state["question"] = ""