Spaces:
Running
Running
simpify chat app
Browse files
app.py
CHANGED
|
@@ -3,19 +3,16 @@ from openai import OpenAI
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
|
| 6 |
-
WELCOME_MESSAGE = """Hello 👋
|
| 7 |
-
|
| 8 |
-
I'm a chatbot assistant for [Jeremy Pinto (@jerpint)'s](https://www.jerpint.io) resume.
|
| 9 |
|
| 10 |
Here's a quick overview of Jeremy:
|
| 11 |
-
-
|
| 12 |
-
- Currently works at [Mila](www.mila.quebec) as a Senior Applied Research Scientist
|
| 13 |
- Hosts a blog at [www.jerpint.io]()
|
| 14 |
|
| 15 |
-
|
| 16 |
"""
|
| 17 |
|
| 18 |
-
SYSTEM_PROMPT = "You are a helpful assistant
|
| 19 |
PROMPT_TEMPLATE = """Here is all the information you need to know about a candidate, in markdown format:
|
| 20 |
|
| 21 |
{resume_markdown}
|
|
@@ -85,19 +82,19 @@ def respond(
|
|
| 85 |
|
| 86 |
|
| 87 |
with gr.Blocks() as demo:
|
| 88 |
-
md = gr.Markdown("Interactive chat with Jeremy's resume. For more information, visit [jerpint.io/resume](https://www.jerpint.io/resume)")
|
| 89 |
-
with gr.Tab("Resume (Chat)"):
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
)
|
| 102 |
|
| 103 |
# with gr.Tab("Resume (HTML)"):
|
|
@@ -105,8 +102,8 @@ with gr.Blocks() as demo:
|
|
| 105 |
# html_raw = f.read()
|
| 106 |
# resume_html = gr.HTML(html_raw)
|
| 107 |
|
| 108 |
-
with gr.Tab("Resume (PDF)"):
|
| 109 |
-
md = gr.Markdown("[Link to PDF](https://huggingface.co/spaces/jerpint/talk-to-resume/resolve/main/resume.pdf)")
|
| 110 |
|
| 111 |
md = gr.Markdown("Created by [Jeremy Pinto](https://www.jerpint.io)")
|
| 112 |
|
|
|
|
| 3 |
import os
|
| 4 |
|
| 5 |
|
| 6 |
+
WELCOME_MESSAGE = """Hello 👋 I'm a chatbot assistant for [Jeremy Pinto (@jerpint)'s](https://www.jerpint.io) resume.
|
|
|
|
|
|
|
| 7 |
|
| 8 |
Here's a quick overview of Jeremy:
|
| 9 |
+
- Member of Tehcnical staff at Onix
|
|
|
|
| 10 |
- Hosts a blog at [www.jerpint.io]()
|
| 11 |
|
| 12 |
+
How can I help?
|
| 13 |
"""
|
| 14 |
|
| 15 |
+
SYSTEM_PROMPT = "You are a helpful assistant prodiving answers given a candidate's resume."
|
| 16 |
PROMPT_TEMPLATE = """Here is all the information you need to know about a candidate, in markdown format:
|
| 17 |
|
| 18 |
{resume_markdown}
|
|
|
|
| 82 |
|
| 83 |
|
| 84 |
with gr.Blocks() as demo:
|
| 85 |
+
# md = gr.Markdown("Interactive chat with Jeremy's resume. For more information, visit [jerpint.io/resume](https://www.jerpint.io/resume)")
|
| 86 |
+
# with gr.Tab("Resume (Chat)"):
|
| 87 |
+
|
| 88 |
+
# Initialize history with a welcome message
|
| 89 |
+
history = [
|
| 90 |
+
{"role": "assistant", "content": WELCOME_MESSAGE},
|
| 91 |
+
]
|
| 92 |
+
|
| 93 |
+
default_chatbot=gr.Chatbot(value=history, label="jerpint's assistant", type="messages")
|
| 94 |
+
chatbot = gr.ChatInterface(
|
| 95 |
+
respond,
|
| 96 |
+
chatbot=default_chatbot,
|
| 97 |
+
type="messages",
|
| 98 |
)
|
| 99 |
|
| 100 |
# with gr.Tab("Resume (HTML)"):
|
|
|
|
| 102 |
# html_raw = f.read()
|
| 103 |
# resume_html = gr.HTML(html_raw)
|
| 104 |
|
| 105 |
+
# with gr.Tab("Resume (PDF)"):
|
| 106 |
+
# md = gr.Markdown("[Link to PDF](https://huggingface.co/spaces/jerpint/talk-to-resume/resolve/main/resume.pdf)")
|
| 107 |
|
| 108 |
md = gr.Markdown("Created by [Jeremy Pinto](https://www.jerpint.io)")
|
| 109 |
|