Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -42,7 +42,12 @@ def scrape_kosdaq_data():
|
|
42 |
for row in rows:
|
43 |
cols = row.find_all("td")
|
44 |
if cols: # ๋น ํ ์ ์ธ
|
|
|
45 |
row_data = [col.get_text(strip=True) for col in cols]
|
|
|
|
|
|
|
|
|
46 |
data.append(row_data)
|
47 |
print(f"๋๋ฒ๊น
: ์ถ์ถ๋ ๋ฐ์ดํฐ ํ ์ - {len(data)}")
|
48 |
|
@@ -60,7 +65,10 @@ def scrape_kosdaq_data():
|
|
60 |
def display_kosdaq_info():
|
61 |
# ๋ฐ์ดํฐ ์คํฌ๋ํ ๋ฐ ๋ฐํ
|
62 |
df = scrape_kosdaq_data()
|
63 |
-
|
|
|
|
|
|
|
64 |
|
65 |
# Gradio UI ์ค์
|
66 |
gr.Interface(
|
|
|
42 |
for row in rows:
|
43 |
cols = row.find_all("td")
|
44 |
if cols: # ๋น ํ ์ ์ธ
|
45 |
+
# ๊ฐ ์ด์ ํ
์คํธ๋ฅผ ์ถ์ถ
|
46 |
row_data = [col.get_text(strip=True) for col in cols]
|
47 |
+
# ๋งํฌ๊ฐ ์๋ ๊ฒฝ์ฐ ์ข
๋ชฉ๋ช
์ ์ถ๊ฐ
|
48 |
+
link = row.find("a", class_="tltle")
|
49 |
+
if link:
|
50 |
+
row_data[1] = link.text.strip()
|
51 |
data.append(row_data)
|
52 |
print(f"๋๋ฒ๊น
: ์ถ์ถ๋ ๋ฐ์ดํฐ ํ ์ - {len(data)}")
|
53 |
|
|
|
65 |
def display_kosdaq_info():
|
66 |
# ๋ฐ์ดํฐ ์คํฌ๋ํ ๋ฐ ๋ฐํ
|
67 |
df = scrape_kosdaq_data()
|
68 |
+
if not df.empty:
|
69 |
+
return df
|
70 |
+
else:
|
71 |
+
return pd.DataFrame({"๊ฒฐ๊ณผ": ["๋ฐ์ดํฐ๋ฅผ ๊ฐ์ ธ์ค๋ ๋ฐ ์คํจํ์ต๋๋ค."]})
|
72 |
|
73 |
# Gradio UI ์ค์
|
74 |
gr.Interface(
|