Spaces:
Sleeping
Sleeping
app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,10 @@
|
|
| 1 |
-
|
| 2 |
import requests
|
| 3 |
import gradio as gr
|
| 4 |
|
| 5 |
def get_crypto_compare_price():
|
| 6 |
"""Fetch the Bitcoin price from CryptoCompare."""
|
| 7 |
try:
|
| 8 |
-
|
| 9 |
-
api_key = 'c1e07b0b9a72b6f5ea096763a17a2a1eec7a925a10faadd615b2d152f208a98d'
|
| 10 |
headers = {
|
| 11 |
'Authorization': f'Apikey {api_key}'
|
| 12 |
}
|
|
@@ -66,14 +64,14 @@ def analyze_btc(prompt):
|
|
| 66 |
elif "trade data" in prompt.lower():
|
| 67 |
return get_real_time_trade_data()
|
| 68 |
elif "chart" in prompt.lower():
|
| 69 |
-
return get_tradingview_chart()
|
| 70 |
return "Try asking about the BTC price, real-time trade data, or TradingView chart."
|
| 71 |
|
| 72 |
# Set up the Gradio interface
|
| 73 |
interface = gr.Interface(
|
| 74 |
fn=analyze_btc,
|
| 75 |
inputs="text",
|
| 76 |
-
outputs="
|
| 77 |
title="Bitcoin Analyzer",
|
| 78 |
description="Ask about the current Bitcoin price, real-time trade data, or TradingView chart."
|
| 79 |
)
|
|
|
|
|
|
|
| 1 |
import requests
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
def get_crypto_compare_price():
|
| 5 |
"""Fetch the Bitcoin price from CryptoCompare."""
|
| 6 |
try:
|
| 7 |
+
api_key = 'c1e07b0b9a72b6f5ea096763a17a2a1eec7a925a10faadd615b2d152f208a98d' # Replace with your actual CryptoCompare API key
|
|
|
|
| 8 |
headers = {
|
| 9 |
'Authorization': f'Apikey {api_key}'
|
| 10 |
}
|
|
|
|
| 64 |
elif "trade data" in prompt.lower():
|
| 65 |
return get_real_time_trade_data()
|
| 66 |
elif "chart" in prompt.lower():
|
| 67 |
+
return gr.HTML(get_tradingview_chart()) # Return HTML for TradingView chart
|
| 68 |
return "Try asking about the BTC price, real-time trade data, or TradingView chart."
|
| 69 |
|
| 70 |
# Set up the Gradio interface
|
| 71 |
interface = gr.Interface(
|
| 72 |
fn=analyze_btc,
|
| 73 |
inputs="text",
|
| 74 |
+
outputs="html", # Change output to HTML to display the TradingView chart
|
| 75 |
title="Bitcoin Analyzer",
|
| 76 |
description="Ask about the current Bitcoin price, real-time trade data, or TradingView chart."
|
| 77 |
)
|