Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,6 @@ import csv
|
|
| 7 |
import threading
|
| 8 |
from huggingface_hub import HfApi
|
| 9 |
import os
|
| 10 |
-
import io
|
| 11 |
|
| 12 |
# Hugging Face Info
|
| 13 |
HF_USERNAME = "abolfazle80"
|
|
@@ -21,6 +20,9 @@ markets = ['DOTUSDT', 'BTCUSDT', 'ADAUSDT', 'BNBUSDT', 'SUIUSDT', 'XRPUSDT']
|
|
| 21 |
# Initialize Hugging Face API
|
| 22 |
api = HfApi()
|
| 23 |
|
|
|
|
|
|
|
|
|
|
| 24 |
# Function to fetch data from CoinEx
|
| 25 |
def get_crypto_price_from_coinex(symbol):
|
| 26 |
url = 'https://api.coinex.com/v1/market/ticker'
|
|
@@ -113,6 +115,7 @@ st.title("🔄 Live Cryptocurrency Data Fetching")
|
|
| 113 |
|
| 114 |
# Start Fetching Button
|
| 115 |
if st.button("Start Fetching Data"):
|
|
|
|
| 116 |
if not loop_running:
|
| 117 |
loop_running = True
|
| 118 |
threading.Thread(target=fetch_data, daemon=True).start()
|
|
|
|
| 7 |
import threading
|
| 8 |
from huggingface_hub import HfApi
|
| 9 |
import os
|
|
|
|
| 10 |
|
| 11 |
# Hugging Face Info
|
| 12 |
HF_USERNAME = "abolfazle80"
|
|
|
|
| 20 |
# Initialize Hugging Face API
|
| 21 |
api = HfApi()
|
| 22 |
|
| 23 |
+
# 🔹 Initialize loop control variable
|
| 24 |
+
loop_running = False
|
| 25 |
+
|
| 26 |
# Function to fetch data from CoinEx
|
| 27 |
def get_crypto_price_from_coinex(symbol):
|
| 28 |
url = 'https://api.coinex.com/v1/market/ticker'
|
|
|
|
| 115 |
|
| 116 |
# Start Fetching Button
|
| 117 |
if st.button("Start Fetching Data"):
|
| 118 |
+
global loop_running
|
| 119 |
if not loop_running:
|
| 120 |
loop_running = True
|
| 121 |
threading.Thread(target=fetch_data, daemon=True).start()
|