Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,28 @@
|
|
1 |
import subprocess
|
2 |
-
|
3 |
-
|
4 |
-
subprocess.run(["pip", "install", "--upgrade", "pip"])
|
5 |
-
subprocess.run(["pip", "install", "--upgrade", "openai", "yfinance", "gradio", "matplotlib", "Pillow"])
|
6 |
-
|
7 |
-
# ์ดํ ์ฝ๋ ์คํ
|
8 |
-
import requests
|
9 |
-
import gradio as gr
|
10 |
-
import yfinance as yf
|
11 |
import matplotlib.pyplot as plt
|
12 |
import io
|
13 |
from PIL import Image
|
14 |
-
|
|
|
|
|
15 |
from openai import OpenAI
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
# Perplexity AI API ์ค์
|
19 |
API_KEY = "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" # ์ฌ๊ธฐ์ Perplexity AI API ํค๋ฅผ ์
๋ ฅํ์ธ์.
|
|
|
1 |
import subprocess
|
2 |
+
import os
|
3 |
+
import matplotlib.font_manager as fm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
import matplotlib.pyplot as plt
|
5 |
import io
|
6 |
from PIL import Image
|
7 |
+
import yfinance as yf
|
8 |
+
import gradio as gr
|
9 |
+
from datetime import datetime
|
10 |
from openai import OpenAI
|
11 |
+
|
12 |
+
# 1. ๋๋๊ณ ๋ ํฐํธ ์ค์น ๋ฐ ์ ์ฉ
|
13 |
+
subprocess.run(["apt-get", "install", "-y", "fonts-nanum"])
|
14 |
+
subprocess.run(["fc-cache", "-fv"])
|
15 |
+
|
16 |
+
# ๋๋๊ณ ๋ ํฐํธ ๊ฒฝ๋ก ์ค์ ๋ฐ ๊ฐ์ ์ ์ฉ
|
17 |
+
font_path = '/usr/share/fonts/truetype/nanum/NanumGothic.ttf'
|
18 |
+
|
19 |
+
if os.path.exists(font_path):
|
20 |
+
fm.fontManager.addfont(font_path)
|
21 |
+
font_prop = fm.FontProperties(fname=font_path)
|
22 |
+
plt.rcParams['font.family'] = font_prop.get_name()
|
23 |
+
plt.rcParams['axes.unicode_minus'] = False # ๋ง์ด๋์ค ๋ถํธ ๊นจ์ง ๋ฐฉ์ง
|
24 |
+
else:
|
25 |
+
print("ํฐํธ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.")
|
26 |
|
27 |
# Perplexity AI API ์ค์
|
28 |
API_KEY = "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" # ์ฌ๊ธฐ์ Perplexity AI API ํค๋ฅผ ์
๋ ฅํ์ธ์.
|