Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,8 @@ import openai
|
|
4 |
import faiss
|
5 |
import os
|
6 |
import numpy as np
|
7 |
-
|
8 |
-
|
9 |
|
10 |
# Function to extract text from a PDF file
|
11 |
def extract_text_from_pdf(pdf_file):
|
@@ -81,7 +81,7 @@ if openai_api_key:
|
|
81 |
|
82 |
# Get the GPT-4 response
|
83 |
response = openai.ChatCompletion.create(
|
84 |
-
model="gpt-
|
85 |
messages=[{"role": "user", "content": modified_prompt}]
|
86 |
)
|
87 |
|
@@ -91,3 +91,15 @@ if openai_api_key:
|
|
91 |
# Display the response in Streamlit (Intelligent Reply)
|
92 |
st.write("### Intelligent Reply:")
|
93 |
st.write(response_content)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
import faiss
|
5 |
import os
|
6 |
import numpy as np
|
7 |
+
import pyautogui
|
8 |
+
import time
|
9 |
|
10 |
# Function to extract text from a PDF file
|
11 |
def extract_text_from_pdf(pdf_file):
|
|
|
81 |
|
82 |
# Get the GPT-4 response
|
83 |
response = openai.ChatCompletion.create(
|
84 |
+
model="gpt-4", # Update to GPT-4 (or your desired model)
|
85 |
messages=[{"role": "user", "content": modified_prompt}]
|
86 |
)
|
87 |
|
|
|
91 |
# Display the response in Streamlit (Intelligent Reply)
|
92 |
st.write("### Intelligent Reply:")
|
93 |
st.write(response_content)
|
94 |
+
|
95 |
+
# Capture a screenshot of the content displayed in Streamlit
|
96 |
+
# Wait for the UI to render
|
97 |
+
time.sleep(2) # Allow time for Streamlit to render the response
|
98 |
+
|
99 |
+
# Capture screenshot of the whole screen
|
100 |
+
screenshot = pyautogui.screenshot()
|
101 |
+
|
102 |
+
# Save the screenshot
|
103 |
+
screenshot.save("response_screenshot.png")
|
104 |
+
|
105 |
+
st.write("Screenshot has been saved as 'response_screenshot.png'.")
|