Spaces:
Sleeping
Sleeping
app.py
Browse files
app.py
CHANGED
|
@@ -4,8 +4,8 @@ import pandas as pd
|
|
| 4 |
import plotly.graph_objs as go
|
| 5 |
from transformers import pipeline
|
| 6 |
|
| 7 |
-
# Load
|
| 8 |
-
chatgpt = pipeline("text-generation", model="gpt2")
|
| 9 |
|
| 10 |
# Function to fetch and process data from GPT model
|
| 11 |
def fetch_and_process_data(prompt):
|
|
@@ -42,8 +42,12 @@ def plot_historical_prices(coin_name, from_date, to_date):
|
|
| 42 |
|
| 43 |
fig = go.Figure()
|
| 44 |
fig.add_trace(go.Scatter(x=df['date'], y=df['price'], mode='lines', name=coin_name))
|
| 45 |
-
fig.update_layout(title=f'{coin_name.capitalize()} Prices from {from_date} to {to_date}',
|
| 46 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
# Top 100 Cryptocurrencies (by CoinGecko IDs)
|
| 49 |
top_100_cryptos = [
|
|
@@ -72,7 +76,7 @@ interface = gr.Interface(
|
|
| 72 |
],
|
| 73 |
outputs=[
|
| 74 |
gr.Textbox(label="ChatGPT Response"),
|
| 75 |
-
gr.
|
| 76 |
],
|
| 77 |
title="ChatGPT and Cryptocurrency Analysis",
|
| 78 |
description="This tool provides real-time cryptocurrency analysis and allows you to interact with ChatGPT for insights."
|
|
|
|
| 4 |
import plotly.graph_objs as go
|
| 5 |
from transformers import pipeline
|
| 6 |
|
| 7 |
+
# Load GPT-2 model (adjust if you're using a different supported model)
|
| 8 |
+
chatgpt = pipeline("text-generation", model="gpt2")
|
| 9 |
|
| 10 |
# Function to fetch and process data from GPT model
|
| 11 |
def fetch_and_process_data(prompt):
|
|
|
|
| 42 |
|
| 43 |
fig = go.Figure()
|
| 44 |
fig.add_trace(go.Scatter(x=df['date'], y=df['price'], mode='lines', name=coin_name))
|
| 45 |
+
fig.update_layout(title=f'{coin_name.capitalize()} Prices from {from_date} to {to_date}',
|
| 46 |
+
xaxis_title='Date',
|
| 47 |
+
yaxis_title='Price (USD)')
|
| 48 |
+
|
| 49 |
+
# Return the plot as an HTML div element
|
| 50 |
+
return fig.to_html()
|
| 51 |
|
| 52 |
# Top 100 Cryptocurrencies (by CoinGecko IDs)
|
| 53 |
top_100_cryptos = [
|
|
|
|
| 76 |
],
|
| 77 |
outputs=[
|
| 78 |
gr.Textbox(label="ChatGPT Response"),
|
| 79 |
+
gr.HTML(label="Cryptocurrency Price Chart")
|
| 80 |
],
|
| 81 |
title="ChatGPT and Cryptocurrency Analysis",
|
| 82 |
description="This tool provides real-time cryptocurrency analysis and allows you to interact with ChatGPT for insights."
|