Spaces:
Runtime error
Runtime error
Download frontend/test.py from HemanthSai7/StudybotAPI: direct link, hf CLI and curl.
- Browser
- Download file 683 Bytes
-
https://huggingface.co/spaces/HemanthSai7/StudybotAPI/resolve/main/frontend/test.py
- Command line
-
hf download hf://spaces/HemanthSai7/StudybotAPI/frontend/test.py
-
curl -L -o test.py https://huggingface.co/spaces/HemanthSai7/StudybotAPI/resolve/main/frontend/test.py
683 Bytes
| 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"] = "" | |