Update app.py
Browse files
app.py
CHANGED
@@ -171,11 +171,12 @@ def display_stock_with_highlight(input_value, change_type, percent_change):
|
|
171 |
plt.text(index, row['Close'], index.strftime('%Y-%m-%d'), fontsize=10, fontweight='bold', color=color, ha='right')
|
172 |
plt.axvline(x=index, color=color, linestyle='--', linewidth=1) # x축과의 연결선 점선으로 표시
|
173 |
|
174 |
-
# 종목명 + '주가 추이'로 제목 설정
|
175 |
-
|
|
|
176 |
plt.xlabel('날짜', fontproperties=font_prop)
|
177 |
plt.ylabel('종가', fontproperties=font_prop)
|
178 |
-
plt.legend(
|
179 |
|
180 |
buf = io.BytesIO()
|
181 |
plt.savefig(buf, format='png')
|
@@ -216,7 +217,7 @@ with gr.Blocks() as demo:
|
|
216 |
|
217 |
with gr.Column(): # 뉴스 요약을 출력할 세 번째 열
|
218 |
# news_output을 gr.Markdown으로 변경
|
219 |
-
news_output = gr.Markdown(label="뉴스 요약")
|
220 |
|
221 |
# Submit 버튼 클릭 시 그래프 및 날짜 드롭다운 업데이트
|
222 |
submit_btn.click(
|
|
|
171 |
plt.text(index, row['Close'], index.strftime('%Y-%m-%d'), fontsize=10, fontweight='bold', color=color, ha='right')
|
172 |
plt.axvline(x=index, color=color, linestyle='--', linewidth=1) # x축과의 연결선 점선으로 표시
|
173 |
|
174 |
+
# 종목명 + '주가 추이'로 제목 설정 (종목명 기반)
|
175 |
+
company_name = list(name_to_ticker.keys())[list(name_to_ticker.values()).index(ticker)]
|
176 |
+
plt.title(f'{company_name} 주가 추이', fontproperties=font_prop)
|
177 |
plt.xlabel('날짜', fontproperties=font_prop)
|
178 |
plt.ylabel('종가', fontproperties=font_prop)
|
179 |
+
plt.legend()
|
180 |
|
181 |
buf = io.BytesIO()
|
182 |
plt.savefig(buf, format='png')
|
|
|
217 |
|
218 |
with gr.Column(): # 뉴스 요약을 출력할 세 번째 열
|
219 |
# news_output을 gr.Markdown으로 변경
|
220 |
+
news_output = gr.Markdown(label="뉴스 요약", value="") # 빈 칸으로 기본 표시
|
221 |
|
222 |
# Submit 버튼 클릭 시 그래프 및 날짜 드롭다운 업데이트
|
223 |
submit_btn.click(
|