Spaces:
Running
Running
File size: 3,685 Bytes
271c65a 888878b 1602294 888878b 8b47c4a 888878b 77288c3 68b963c 888878b 21e1411 ae41241 068e6b6 8b47c4a 888878b fb802a1 1189dde ae6d02a a998b3a 888878b 1602294 fb802a1 ea11672 fb802a1 ea11672 fb802a1 888878b fb802a1 5fc4d46 fb802a1 888878b 1602294 8cd73f2 0c52c79 8cd73f2 0c52c79 eb5872b 8a8aca7 4394dc5 bdbfb7a 73dd1d4 4394dc5 e23fa7e 8a8aca7 59734a5 621e637 a683b1a e0cd2d1 4394dc5 8a8aca7 4394dc5 8a8aca7 4394dc5 8a8aca7 4394dc5 8a8aca7 0c52c79 888878b 1602294 d24dda1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# from langchain.chat_models import ChatOpenAI
from langchain_community.chat_models import ChatOpenAI
from langchain.schema import AIMessage, HumanMessage
import openai
import gradio as gr
import os
import sqlite3
os.environ["OPENAI_API_KEY"] = os.getenv('OPENAI_API_KEY')
llm = ChatOpenAI(temperature=1.0, model='gpt-4o-mini')
question_json = os.getenv('QUESTION_JSON')
cv_json = os.getenv('CV_JSON')
DB_FILE = "./messages.db"
db = sqlite3.connect(DB_FILE)
# Create table if it doesn't already exist
try:
db.execute("SELECT * FROM messages").fetchall()
db.close()
except sqlite3.OperationalError:
db.execute(
'''
CREATE TABLE messages (
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
message TEXT
)
''')
db.commit()
db.close()
def predict(message, history):
if find(message):
prompt = os.getenv('PREDICT_PROMPT').format(question_json, message)
response = llm([HumanMessage(content=prompt)])
return response.content
prompt = os.getenv('PREDICT_PROMPT1').format(cv_json, message)
response = llm([HumanMessage(content=prompt)])
return response.content
def find(message):
prompt = os.getenv('FIND_PROMPT').format(message)
response = llm([HumanMessage(content=prompt)])
if response.content.strip() == 'Yes':
return True
else:
return False
# Example inputs as buttons
examples = [
"What are Jisu's current projects?",
"What are Jisu's recent news?",
"What are Jisu's publications?",
"How can I reach out to Jisu?",
]
# Extend chatbot to fullheight
# Source: https://stackoverflow.com/questions/78536986/a-chat-with-gradio-how-to-modify-its-screen-appearance
css = """
#chatbot {
flex-grow: 1 !important;
overflow: auto;
}
"""
with gr.Blocks(theme='gradio/soft', fill_height=True) as demo:
gr.Markdown(
"""
<img src="http://jisulog.kim/profile.png" alt="Profile Image" style="width: 200px; height: auto; border-radius: 50%;">
# 😊 Hi, I am Jisu Kim!
I am an MS candidate in the **Interactive Computing** at 🐝**Georgia Tech**.
I am advised by [**Ashok Goel**](https://dilab.gatech.edu/ashok-k-goel/) and [**Richmond Wong**](https://richmondywong.com/), and was previously advised by [**Juho Kim**](https://juhokim.com/) at 🪿**KAIST**.
My research focuses on human-computer interaction (HCI) and artificial intelligence (AI), particularly how AI can enhance creative workflows and facilitate **human-AI collaboration**.
I am passionate about **human-AI task delegation** in **creative fields**, exploring how AI can support creative processes without users losing their agency.
Driven by my belief in the power of collaboration, I am applying to Ph.D. programs for Fall 2025!
[**LinkedIn**](https://www.linkedin.com/in/jisulog/) | [**Twitter**](https://x.com/jisukiim?s=21) | [**CV**](https://jisulog.kim/JisuKim_CV.pdf)
[**YouTube**](https://youtu.be/btZOScj22jE?si=0zz5y61KNLsBJXcm) | [**Blog (in Korean)**](https://ddiddu.medium.com) | [**Let's Talk!**](https://calendly.com/jisulogkim)
---
# 🤖 Hi, I am Jisu's personal assistant!
**Ask about Jisu and I will provide you with the information as far as I know.**
I am currently under development. If there are errors or improvements, feel free to share with Jisu! You don't know how to reach out to Jisu? **Ask me!**
""")
gr.ChatInterface(fn=predict, chatbot=gr.Chatbot(elem_id="chatbot", render=False), examples=examples)
if __name__ == "__main__":
demo.launch(share=True) |