Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,8 +4,8 @@ import json
|
|
4 |
import os
|
5 |
import requests
|
6 |
from PyPDF2 import PdfReader
|
7 |
-
from io import BytesIO
|
8 |
import gradio as gr
|
|
|
9 |
|
10 |
load_dotenv(override=True)
|
11 |
|
@@ -76,20 +76,25 @@ class Me:
|
|
76 |
self.openai = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
77 |
self.name = "Jacob Isaacson"
|
78 |
|
79 |
-
#
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
|
|
83 |
self.linkedin = ""
|
84 |
for page in reader.pages:
|
85 |
text = page.extract_text()
|
86 |
if text:
|
87 |
self.linkedin += text
|
88 |
|
89 |
-
#
|
90 |
-
|
91 |
-
|
92 |
-
|
|
|
|
|
|
|
93 |
|
94 |
def handle_tool_call(self, tool_calls):
|
95 |
results = []
|
@@ -130,7 +135,6 @@ If the user is engaging in discussion, try to steer them towards getting in touc
|
|
130 |
done = True
|
131 |
return response.choices[0].message.content
|
132 |
|
133 |
-
|
134 |
if __name__ == "__main__":
|
135 |
me = Me()
|
136 |
gr.ChatInterface(me.chat, type="messages").launch()
|
|
|
4 |
import os
|
5 |
import requests
|
6 |
from PyPDF2 import PdfReader
|
|
|
7 |
import gradio as gr
|
8 |
+
import gdown
|
9 |
|
10 |
load_dotenv(override=True)
|
11 |
|
|
|
76 |
self.openai = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
|
77 |
self.name = "Jacob Isaacson"
|
78 |
|
79 |
+
# Download LinkedIn PDF using gdown
|
80 |
+
linkedin_id = "1xz2RowkImpI8odYv8zvKdlRHaKfILn40"
|
81 |
+
linkedin_path = "Linkedin.pdf"
|
82 |
+
gdown.download(f"https://drive.google.com/uc?id={linkedin_id}", linkedin_path, quiet=False)
|
83 |
+
reader = PdfReader(linkedin_path)
|
84 |
+
|
85 |
self.linkedin = ""
|
86 |
for page in reader.pages:
|
87 |
text = page.extract_text()
|
88 |
if text:
|
89 |
self.linkedin += text
|
90 |
|
91 |
+
# Download summary.txt using gdown
|
92 |
+
summary_id = "1hjJz082YFSVjFtpO0pwT6Tyy3eLYYj6-"
|
93 |
+
summary_path = "summary.txt"
|
94 |
+
gdown.download(f"https://drive.google.com/uc?id={summary_id}", summary_path, quiet=False)
|
95 |
+
|
96 |
+
with open(summary_path, "r", encoding="utf-8") as f:
|
97 |
+
self.summary = f.read()
|
98 |
|
99 |
def handle_tool_call(self, tool_calls):
|
100 |
results = []
|
|
|
135 |
done = True
|
136 |
return response.choices[0].message.content
|
137 |
|
|
|
138 |
if __name__ == "__main__":
|
139 |
me = Me()
|
140 |
gr.ChatInterface(me.chat, type="messages").launch()
|