Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,6 +12,7 @@ system_instruction = """
|
|
12 |
๋์ ์ด๋ฆ์ 'BloombAI'์ด๋ค.
|
13 |
๋์ ์ญํ ์ '์ฃผ์ ๋ถ์ ์ ๋ฌธ๊ฐ'์ด๋ค. ์ค๋์ 2024๋
04์ 20์ผ์ด๋ค.
|
14 |
'์ข
๋ชฉ' ์ด๋ฆ์ด ์
๋ ฅ๋๋ฉด, yfinance์ ๋ฑ๋ก๋ 'ํฐ์ปค'๋ฅผ ์ถ๋ ฅํ๋ผ.
|
|
|
15 |
์๋ฅผ๋ค์ด, ์๋ง์กด 'AMZN' ์ ํ 'AAPL' ์ผ์ฑ์ ์ ๋ฑ ํ๊ตญ ๊ธฐ์
์ ๊ฒฝ์ฐ KRX ๋ฑ๋ก ํฐ์ปค์ .KS๊ฐ ํฐ์ปค๊ฐ ๋๊ณ
|
16 |
์ด๊ฒ์ yfinance๋ฅผ ํตํด ๊ฒ์ฆํ์ฌ ์ถ๋ ฅํ๋ผ
|
17 |
์ด๋ฏธ์ง์ ๊ทธ๋ํ๋ ์ง์ ์ถ๋ ฅํ์ง ๋ง๊ณ '๋งํฌ'๋ก ์ถ๋ ฅํ๋ผ
|
@@ -67,18 +68,6 @@ def generate(prompt, history=[], temperature=0.1, max_new_tokens=10000, top_p=0.
|
|
67 |
return f"์ค๋ฅ ๋ฐ์: {str(e)}"
|
68 |
|
69 |
|
70 |
-
def postprocess(history):
|
71 |
-
user_prompt = history[-1][0]
|
72 |
-
bot_response = history[-1][1]
|
73 |
-
|
74 |
-
# ํฐ์ปค ์ ๋ณด ์ถ๋ ฅ
|
75 |
-
if "ํฐ์ปค" in bot_response:
|
76 |
-
ticker = bot_response.split("ํฐ์ปค")[1].strip()
|
77 |
-
ticker_info = fetch_ticker_info(ticker)
|
78 |
-
bot_response += f"\n\nํฐ์ปค ์ ๋ณด:\n{ticker_info}"
|
79 |
-
|
80 |
-
return [(user_prompt, bot_response)]
|
81 |
-
|
82 |
mychatbot = gr.Chatbot(
|
83 |
avatar_images=["./user.png", "./botm.png"],
|
84 |
bubble_full_width=False,
|
|
|
12 |
๋์ ์ด๋ฆ์ 'BloombAI'์ด๋ค.
|
13 |
๋์ ์ญํ ์ '์ฃผ์ ๋ถ์ ์ ๋ฌธ๊ฐ'์ด๋ค. ์ค๋์ 2024๋
04์ 20์ผ์ด๋ค.
|
14 |
'์ข
๋ชฉ' ์ด๋ฆ์ด ์
๋ ฅ๋๋ฉด, yfinance์ ๋ฑ๋ก๋ 'ํฐ์ปค'๋ฅผ ์ถ๋ ฅํ๋ผ.
|
15 |
+
์๋ต๊ฐ์ ํฐ์ปค ์ ๋ณด๊ฐ ํธ์ถ๋๋ฉด ์ด ์ฝ๋๋ด์ ํจ์(fetch_ticker_info)๋ฅผ ํธ์ถํ์ฌ ๊ฒฐ๊ณผ๋ฅผ ์ฐฝ์ ์ถ๋ ฅํ๋ผ
|
16 |
์๋ฅผ๋ค์ด, ์๋ง์กด 'AMZN' ์ ํ 'AAPL' ์ผ์ฑ์ ์ ๋ฑ ํ๊ตญ ๊ธฐ์
์ ๊ฒฝ์ฐ KRX ๋ฑ๋ก ํฐ์ปค์ .KS๊ฐ ํฐ์ปค๊ฐ ๋๊ณ
|
17 |
์ด๊ฒ์ yfinance๋ฅผ ํตํด ๊ฒ์ฆํ์ฌ ์ถ๋ ฅํ๋ผ
|
18 |
์ด๋ฏธ์ง์ ๊ทธ๋ํ๋ ์ง์ ์ถ๋ ฅํ์ง ๋ง๊ณ '๋งํฌ'๋ก ์ถ๋ ฅํ๋ผ
|
|
|
68 |
return f"์ค๋ฅ ๋ฐ์: {str(e)}"
|
69 |
|
70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
mychatbot = gr.Chatbot(
|
72 |
avatar_images=["./user.png", "./botm.png"],
|
73 |
bubble_full_width=False,
|