Spaces:
Running
Running
import ssl | |
import logging | |
import gradio as gr | |
import matplotlib.pyplot as plt | |
from io import BytesIO | |
import base64 | |
from datetime import datetime | |
# λ‘κ·Έ μ€μ | |
#logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') | |
# SSL μΈμ¦μ κ²μ¦ λΉνμ±ν | |
ssl._create_default_https_context = ssl._create_unverified_context | |
current_time = datetime.now().strftime("%b-%d-%Y") | |
def load_css(): | |
with open('style.css', 'r', encoding='utf-8') as file: | |
css = file.read() | |
return f"<style>{css}</style>" | |
def format_quantity(quantity): | |
# μμ£Ό μμ κ°μ 0μΌλ‘ μ²λ¦¬ | |
if abs(quantity) < 1e-5: # μκ³κ°μ μ‘°μ νμ¬ λ μ μ ν κ°μ μ€μ ν μ μμ΅λλ€. | |
quantity = 0 | |
if quantity < 0: | |
return f"({-quantity:,.1f})" | |
else: | |
return f"{quantity:,.1f}" | |
def format_value(value): | |
# μμ£Ό μμ κ°μ 0μΌλ‘ μ²λ¦¬ | |
if abs(value) < 1e-5: # μκ³κ°μ μ‘°μ νμ¬ λ μ μ ν κ°μ μ€μ ν μ μμ΅λλ€. | |
value = 0 | |
if value < 0: | |
return f"({-value:,.0f})" | |
else: | |
return f"{value:,.0f}" | |
# currency_symbols = { | |
# "KRW": "β©", | |
# "USD": "$", | |
# "CAD": "$", | |
# "EUR": "β¬", | |
# "JPY": "Β₯", | |
# "GBP": "Β£" | |
# } | |
currency_symbols = { | |
"KRW": "β©", | |
"USD": "$" | |
} | |
def get_currency_symbol(currency_code): | |
return currency_symbols.get(currency_code.upper(), "") | |
def get_currency_codes(): | |
return list(currency_symbols.keys()) | |
currency_codes = get_currency_codes() | |