Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -73,27 +73,30 @@ def generate(prompt, history=[], temperature=0.1, max_new_tokens=10000, top_p=0.
|
|
73 |
except Exception as e:
|
74 |
yield f"Error: {str(e)}\nTotal tokens used: {total_tokens_used}"
|
75 |
|
76 |
-
|
77 |
def setup_interface():
|
78 |
with gr.Blocks() as demo:
|
79 |
gr.Markdown("### 글로벌 자산(주식,지수,상품,가상자산,외환 등) 분석 LLM: BloombAI")
|
80 |
|
81 |
with gr.Row():
|
82 |
-
ticker_input = gr.Textbox(label="티커 입력", placeholder="예: AAPL"
|
83 |
-
submit_button = gr.Button("조회"
|
84 |
|
85 |
chatbot = gr.Chatbot(
|
86 |
avatar_images=["./user.png", "./botm.png"],
|
87 |
bubble_full_width=False,
|
88 |
show_label=False,
|
89 |
show_copy_button=True,
|
90 |
-
likeable=True
|
91 |
-
elem_id="chatbot_area"
|
92 |
)
|
93 |
|
94 |
-
#
|
|
|
|
|
|
|
|
|
95 |
submit_button.click(
|
96 |
-
fn=
|
97 |
inputs=ticker_input,
|
98 |
outputs=chatbot
|
99 |
)
|
@@ -105,12 +108,8 @@ def setup_interface():
|
|
105 |
["추천 종목 알려줘", []],
|
106 |
["그 종목 투자 전망 예측해", []]
|
107 |
]
|
108 |
-
|
109 |
-
|
110 |
-
inputs=[gr.Textbox(label="메시지 입력", elem_id="message_input")],
|
111 |
-
outputs=chatbot,
|
112 |
-
examples=examples
|
113 |
-
)
|
114 |
|
115 |
return demo
|
116 |
|
|
|
73 |
except Exception as e:
|
74 |
yield f"Error: {str(e)}\nTotal tokens used: {total_tokens_used}"
|
75 |
|
76 |
+
|
77 |
def setup_interface():
|
78 |
with gr.Blocks() as demo:
|
79 |
gr.Markdown("### 글로벌 자산(주식,지수,상품,가상자산,외환 등) 분석 LLM: BloombAI")
|
80 |
|
81 |
with gr.Row():
|
82 |
+
ticker_input = gr.Textbox(label="티커 입력", placeholder="예: AAPL")
|
83 |
+
submit_button = gr.Button("조회")
|
84 |
|
85 |
chatbot = gr.Chatbot(
|
86 |
avatar_images=["./user.png", "./botm.png"],
|
87 |
bubble_full_width=False,
|
88 |
show_label=False,
|
89 |
show_copy_button=True,
|
90 |
+
likeable=True
|
|
|
91 |
)
|
92 |
|
93 |
+
# 버튼 클릭 이벤트를 통해 티커 정보를 채팅 창에 직접 출력
|
94 |
+
def query_and_show(ticker):
|
95 |
+
info = fetch_ticker_info(ticker)
|
96 |
+
return [("", f"티커 '{ticker}'의 정보 조회 결과:\n\n{info}")] # 첫번째 항목은 사용자 메시지, 두번째는 봇의 응답
|
97 |
+
|
98 |
submit_button.click(
|
99 |
+
fn=query_and_show,
|
100 |
inputs=ticker_input,
|
101 |
outputs=chatbot
|
102 |
)
|
|
|
108 |
["추천 종목 알려줘", []],
|
109 |
["그 종목 투자 전망 예측해", []]
|
110 |
]
|
111 |
+
|
112 |
+
chatbot.add_message("환영합니다! 어떤 주식 정보가 궁금하신가요?")
|
|
|
|
|
|
|
|
|
113 |
|
114 |
return demo
|
115 |
|