Yllvar commited on
Commit
d200045
·
verified ·
1 Parent(s): 17273cb

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -0
app.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import ccxt
3
+ import pandas as pd
4
+ from datetime import datetime, timedelta
5
+ from huggingface_hub import HfApi
6
+ import os
7
+ from tqdm import tqdm
8
+ import time
9
+ import logging
10
+
11
+ # Setup logging
12
+ logging.basicConfig(level=logging.INFO)
13
+ logger = logging.getLogger(__name__)
14
+
15
+ def fetch_and_upload_data():
16
+ output_messages = []
17
+ try:
18
+ HF_TOKEN = os.environ.get("HF_TOKEN")
19
+ if not HF_TOKEN:
20
+ return "Error: HF_TOKEN not found in environment variables"
21
+
22
+ # Your existing fetch_and_upload_data code here
23
+ return "Data fetching process started..."
24
+ except Exception as e:
25
+ return f"Error: {str(e)}"
26
+
27
+ # Create Gradio interface
28
+ iface = gr.Interface(
29
+ fn=fetch_and_upload_data,
30
+ inputs=[],
31
+ outputs=gr.Textbox(label="Output Log", lines=20),
32
+ title="Crypto Data Fetcher and Uploader",
33
+ description="Fetch cryptocurrency data from Binance and upload to Hugging Face dataset",
34
+ allow_flagging="never"
35
+ )
36
+
37
+ if __name__ == "__main__":
38
+ iface.launch()