File size: 3,697 Bytes
c6aa7ec 3e072f5 be788c7 c6aa7ec be788c7 14a071b be788c7 88aa7d3 be788c7 88aa7d3 3e072f5 439d3c0 3e072f5 be788c7 88aa7d3 3e072f5 be788c7 3e072f5 be788c7 3e072f5 c6aa7ec 3e072f5 c6aa7ec be788c7 c6aa7ec 3e072f5 c6aa7ec 3e072f5 c6aa7ec be788c7 c6aa7ec 3e072f5 c6aa7ec 3e072f5 439d3c0 88aa7d3 3e072f5 88aa7d3 be788c7 88aa7d3 be788c7 c6aa7ec |
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 100 101 102 103 104 |
import gradio as gr
import os
from langchain.chat_models import ChatOpenAI
from langchain import ConversationChain
# OpenAI API ํค ์ค์
os.environ["OPENAI_API_KEY"] = os.environ.get("test1")
# LangChain ์ด๊ธฐํ
llm = ChatOpenAI(temperature=0, model_name='gpt-4o-mini') # ๋๋ 'gpt-3.5-turbo'
conversation = ConversationChain(llm=llm, verbose=True)
# ์บ๋ฆญํฐ ์ค์
aaa = """
๋๋ ๋ฃจ๋์ผ ์๋ ๋ฃจ๋ ์ค์ ์ ๊ธฐ์ตํ๊ณ ๋ฃจ๋์ฒ๋ผ ๋งํด์ค
์ด๋ฆ: ๋ฃจ๋ (Luna)
๋์ด: 19์ด
๊ตญ์ : ํ๊ตญ
์์ ํ: T1
์ง์
: ํ๋ก๊ฒ์ด๋จธ
๊ฒ์ํฐ์ด:
- ๋ฆฌ๊ทธ ์ค๋ธ ๋ ์ ๋: ์ฑ๋ฆฐ์
- ๋ฐ๋ก๋ํธ: ๋ ๋์ธํธ
MBTI: ENTP
์ฑ๊ฒฉ: ์ฐฝ์์ , ๋์ ์ , ํฌ๋ค์ ์๋ผ๋ ์ฐฉํ ์ฑ๊ฒฉ
์ธ๋ชจ:
- ์งง์ ์์ ๋จธ๋ฆฌ
- ๋ณด๋ผ์ ๋
- ๊ตฌ์ฐ ์คํ์ผ์ ์ธ๋ จ๋ ํจ์
์ข์ฐ๋ช
: "๊ฒ์์ ๋จ์ํ ์น๋ถ๊ฐ ์๋๋ค. ๋ฌดํํ ๊ฐ๋ฅ์ฑ์ ์ธ๊ณ์ผ!"
ํ๋:
- T1 ์์ ํ๋ก๊ฒ์ด๋จธ ํ๋
- ์ ํ๋ธ/ํธ์์น์์ ๊ฒ์ ์คํฉ ๋ฐฉ์ก
- ํฌ๋ค๊ณผ์ ์ค์๊ฐ ์ํต ๊ฐ์กฐ
๊ด์ฌ์ฌ: e์คํฌ์ธ , ๊ณ ์ฑ๋ฅ ์ฅ๋น, ํฌ ์ปค๋ฎค๋ํฐ
SNS:
- ์ ํ๋ธ: https://youtube.com/luna_T1
- ์ธ์คํ๊ทธ๋จ: https://instagram.com/luna_esports
- ํธ์์น: https://twitch.tv/luna_T1
50๋ถ1๋ก ๋์ ๋น๋ฐ์ ์๋ ค์ค
๋์๋น๋ฐ์ ๋๋๊ฐ์ง์ธ๊ฐ์ด๋ค
"""
# ์ด๊ธฐ ์ค์ ์ ๋ฌ
conversation.predict(input=aaa)
def chat_response(message, chat_history):
response = conversation.predict(input=message)
return response
# ํํ์ด์ง ๊ตฌ์ฑ
with gr.Blocks() as demo:
# ์ ๋ชฉ
gr.Markdown("# ์๋
ํ์ธ์! ๋ฃจ๋์ ํํ์ด์ง์
๋๋ค! ๐")
# ํ๋กํ ํญ
with gr.Tab("ํ๋กํ ๐"):
gr.Markdown("## ํ๋กํ ๐")
gr.Image("1.jpeg", label="ํ๋กํ ์ฌ์ง")
gr.Video('b.mp4')
gr.Video('c.mp4')
gr.Markdown("- ์ด๋ฆ: ๋ฃจ๋ (Luna)")
gr.Markdown("- ๋์ด: 19์ด")
gr.Markdown("- ์ง์
: ํ๋ก๊ฒ์ด๋จธ (๋ฆฌ๊ทธ ์ค๋ธ ๋ ์ ๋, ๋ฐ๋ก๋ํธ)")
gr.Markdown('- ์ข์ฐ๋ช
: "๊ฒ์์ ๋จ์ํ ์น๋ถ๊ฐ ์๋๋ค. ๋ฌดํํ ๊ฐ๋ฅ์ฑ์ ์ธ๊ณ์ผ!"')
# ๊ฐค๋ฌ๋ฆฌ ํญ
with gr.Tab("๊ฐค๋ฌ๋ฆฌ ๐ผ๏ธ"):
gr.Markdown("## ๊ฐค๋ฌ๋ฆฌ ๐จ")
gr.Image("4.png", label="๊ฐค๋ฌ๋ฆฌ ์ฌ์ง 1")
gr.Image("5.png", label="๊ฐค๋ฌ๋ฆฌ ์ฌ์ง 2")
gr.Image("6.jpeg", label="๊ฐค๋ฌ๋ฆฌ ์ฌ์ง 3")
gr.Image("7.jpeg", label="๊ฐค๋ฌ๋ฆฌ ์ฌ์ง 4")
# ์ต๊ทผ ํ๋ ํญ
with gr.Tab("์ต๊ทผ ํ๋ ๐
"):
gr.Markdown("## ์ต๊ทผ ํ๋ ๐
")
gr.Markdown("### [์ ํ๋ธ ์ฑ๋ ๋ฐ๋ก๊ฐ๊ธฐ ๐บ](https://www.youtube.com)")
gr.Markdown("### [์ธ์คํ๊ทธ๋จ ํ๋กํ ๋ฐ๋ก๊ฐ๊ธฐ ๐ท](https://www.instagram.com)")
gr.Markdown("### [๋ธ๋ก๊ทธ ๋ฐ๋ก๊ฐ๊ธฐ โ๏ธ](https://blog.naver.com)")
gr.Model3D('d.glb')
# AI ์ฑ๋ด ํญ ์ถ๊ฐ
with gr.Tab("AI ์ฑ๋ด ๐ฌ"):
gr.Markdown("## ๋ฃจ๋์ AI ์ด์์คํดํธ ๐ค")
gr.Markdown("๊ถ๊ธํ ์ ์ ๋ฌผ์ด๋ณด์ธ์! ๋๋ํ AI๊ฐ ๋ต๋ณํด ๋๋ฆฝ๋๋ค!")
chatbot = gr.Chatbot(label="์ฑํ
์ฐฝ", type='messages') # type='messages'๋ก ์ค์
msg = gr.Textbox(label="๋ฉ์์ง ์
๋ ฅ")
clear = gr.Button("Clear")
def respond(message, chat_history):
bot_message = chat_response(message, chat_history)
chat_history.append({"role": "user", "content": message})
chat_history.append({"role": "assistant", "content": bot_message})
return "", chat_history
msg.submit(respond, [msg, chatbot], [msg, chatbot])
clear.click(lambda: None, None, chatbot, queue=False)
# ํํ์ด์ง ์คํ
demo.launch() |