Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,7 @@ def scrape_kosdaq_data():
|
|
20 |
print("λλ²κΉ
: λ€μ΄λ² μ¦κΆ νμ΄μ§ μμ² μ±κ³΅")
|
21 |
else:
|
22 |
print(f"λλ²κΉ
: μμ² μ€ν¨, μν μ½λ: {response.status_code}")
|
23 |
-
return
|
24 |
|
25 |
# HTML νμ±
|
26 |
soup = BeautifulSoup(response.text, "html.parser")
|
@@ -50,6 +50,7 @@ def scrape_kosdaq_data():
|
|
50 |
print(f"λλ²κΉ
: 첫 λ²μ§Έ λ°μ΄ν° ν - {data[0]}")
|
51 |
else:
|
52 |
print("λλ²κΉ
: λ°μ΄ν° μΆμΆ μ€ν¨")
|
|
|
53 |
|
54 |
# DataFrame μμ±
|
55 |
df = pd.DataFrame(data, columns=headers)
|
@@ -59,10 +60,7 @@ def scrape_kosdaq_data():
|
|
59 |
def display_kosdaq_info():
|
60 |
# λ°μ΄ν° μ€ν¬λν λ° λ°ν
|
61 |
df = scrape_kosdaq_data()
|
62 |
-
|
63 |
-
return df
|
64 |
-
else:
|
65 |
-
return "λ°μ΄ν°λ₯Ό κ°μ Έμ€λ λ° μ€ν¨νμ΅λλ€."
|
66 |
|
67 |
# Gradio UI μ€μ
|
68 |
gr.Interface(
|
|
|
20 |
print("λλ²κΉ
: λ€μ΄λ² μ¦κΆ νμ΄μ§ μμ² μ±κ³΅")
|
21 |
else:
|
22 |
print(f"λλ²κΉ
: μμ² μ€ν¨, μν μ½λ: {response.status_code}")
|
23 |
+
return pd.DataFrame() # λΉ DataFrame λ°ν
|
24 |
|
25 |
# HTML νμ±
|
26 |
soup = BeautifulSoup(response.text, "html.parser")
|
|
|
50 |
print(f"λλ²κΉ
: 첫 λ²μ§Έ λ°μ΄ν° ν - {data[0]}")
|
51 |
else:
|
52 |
print("λλ²κΉ
: λ°μ΄ν° μΆμΆ μ€ν¨")
|
53 |
+
return pd.DataFrame(columns=headers) # λΉ DataFrame λ°ν
|
54 |
|
55 |
# DataFrame μμ±
|
56 |
df = pd.DataFrame(data, columns=headers)
|
|
|
60 |
def display_kosdaq_info():
|
61 |
# λ°μ΄ν° μ€ν¬λν λ° λ°ν
|
62 |
df = scrape_kosdaq_data()
|
63 |
+
return df
|
|
|
|
|
|
|
64 |
|
65 |
# Gradio UI μ€μ
|
66 |
gr.Interface(
|