Update app.py
Browse files
app.py
CHANGED
|
@@ -30,6 +30,59 @@ def answer_question(image, question, model, processor):
|
|
| 30 |
answer = processor.decode(out[0], skip_special_tokens=True).strip()
|
| 31 |
return answer
|
| 32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
st.title("Image Question Answering")
|
| 34 |
|
| 35 |
# File uploader for the image
|
|
|
|
| 30 |
answer = processor.decode(out[0], skip_special_tokens=True).strip()
|
| 31 |
return answer
|
| 32 |
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
|
| 41 |
+
# Set up the sidebar navigation
|
| 42 |
+
st.sidebar.title("Navigation")
|
| 43 |
+
selection = st.sidebar.radio("Go to", ["Home", "View PDF", "Run Inference"])
|
| 44 |
+
|
| 45 |
+
# Set up the main page content based on navigation selection
|
| 46 |
+
if selection == "Home":
|
| 47 |
+
st.title("Welcome to LLM Architecture Assessment")
|
| 48 |
+
st.write("Home page content goes here...")
|
| 49 |
+
# You can include more content for the home page here
|
| 50 |
+
|
| 51 |
+
elif selection == "View PDF":
|
| 52 |
+
st.title("View PDF")
|
| 53 |
+
st.write("Click the link below to view the PDF.")
|
| 54 |
+
# Example to display a link to a PDF
|
| 55 |
+
st.download_button(
|
| 56 |
+
label="Download PDF",
|
| 57 |
+
data=open("path/to/your/pdf.pdf", "rb"),
|
| 58 |
+
file_name="example.pdf",
|
| 59 |
+
mime="application/octet-stream"
|
| 60 |
+
)
|
| 61 |
+
# You can include more content for the PDF page here
|
| 62 |
+
|
| 63 |
+
elif selection == "Run Inference":
|
| 64 |
+
st.title("Run Inference")
|
| 65 |
+
st.write("This page allows you to run the space for inference.")
|
| 66 |
+
# You would include your inference code here
|
| 67 |
+
# For example, if you have a form to collect user input for the model:
|
| 68 |
+
user_input = st.text_input("Enter your text here...")
|
| 69 |
+
if st.button("Run"):
|
| 70 |
+
# Call your model inference function
|
| 71 |
+
# result = run_inference(user_input)
|
| 72 |
+
# st.write(result)
|
| 73 |
+
pass # Replace pass with your inference code
|
| 74 |
+
|
| 75 |
+
# Other pages and functionality would be added in a similar manner.
|
| 76 |
+
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
|
| 85 |
+
|
| 86 |
st.title("Image Question Answering")
|
| 87 |
|
| 88 |
# File uploader for the image
|