Download app.py from AMINKI/test: direct link, hf CLI and curl.
- Browser
- Download file 3.7 kB
-
https://huggingface.co/spaces/AMINKI/test/resolve/main/app.py
- Command line
-
hf download hf://spaces/AMINKI/test/app.py
-
curl -L -o app.py https://huggingface.co/spaces/AMINKI/test/resolve/main/app.py
3.7 kB
| 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() |