Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- app.py +20 -8
- human_avatar.png +3 -0
.gitattributes
CHANGED
|
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
avatar1.jpg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
mariebot_avatar.png filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
avatar1.jpg filter=lfs diff=lfs merge=lfs -text
|
| 37 |
mariebot_avatar.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
human_avatar.png filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -31,21 +31,33 @@ Here is some information about her work experience:
|
|
| 31 |
|
| 32 |
Here is some information from the professional website, including her projects and skills:
|
| 33 |
{website_text}
|
| 34 |
-
|
| 35 |
"""
|
| 36 |
|
| 37 |
def chat(message, history):
|
| 38 |
-
messages = [{"role": "system", "content": system_prompt}]
|
| 39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
response = client.chat.completions.create(
|
| 41 |
-
model="gpt-
|
| 42 |
messages=messages,
|
| 43 |
)
|
| 44 |
return response.choices[0].message.content
|
| 45 |
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
gr.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
|
|
|
| 51 |
|
|
|
|
| 31 |
|
| 32 |
Here is some information from the professional website, including her projects and skills:
|
| 33 |
{website_text}
|
|
|
|
| 34 |
"""
|
| 35 |
|
| 36 |
def chat(message, history):
|
| 37 |
+
messages = [{"role": "system", "content": system_prompt}]
|
| 38 |
+
|
| 39 |
+
# Convert history to the format expected by OpenAI
|
| 40 |
+
for user_msg, assistant_msg in history:
|
| 41 |
+
messages.append({"role": "user", "content": user_msg})
|
| 42 |
+
if assistant_msg: # Only add assistant message if it exists
|
| 43 |
+
messages.append({"role": "assistant", "content": assistant_msg})
|
| 44 |
+
|
| 45 |
+
messages.append({"role": "user", "content": message})
|
| 46 |
+
|
| 47 |
response = client.chat.completions.create(
|
| 48 |
+
model="gpt-4",
|
| 49 |
messages=messages,
|
| 50 |
)
|
| 51 |
return response.choices[0].message.content
|
| 52 |
|
| 53 |
+
demo = gr.ChatInterface(
|
| 54 |
+
chat,
|
| 55 |
+
chatbot=gr.Chatbot(avatar_images=["human_avatar.png", "mariebot_avatar.png"]),
|
| 56 |
+
title="Marie's Professional Chat Assistant",
|
| 57 |
+
description="Ask me anything about Marie's professional experience and skills!",
|
| 58 |
+
theme=gr.themes.Ocean(),
|
| 59 |
+
)
|
| 60 |
|
| 61 |
+
if __name__ == "__main__":
|
| 62 |
+
demo.launch(share=False)
|
| 63 |
|
human_avatar.png
ADDED
|
|
Git LFS Details
|