hmxa91 commited on
Commit
8786df8
·
verified ·
1 Parent(s): dd8d8c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -2
app.py CHANGED
@@ -2,7 +2,7 @@ import logging
2
  import json
3
  import gradio as gr
4
  from transformers import pipeline
5
- import torch # Add this line to import torch
6
 
7
  # Set up logging
8
  logging.basicConfig(
@@ -96,4 +96,38 @@ with gr.Blocks() as iface:
96
  {"title": "Bitcoin Price Surges", "description": "Bitcoin's price surged above $30,000."},
97
  {"title": "Bitcoin Faces Challenges", "description": "Regulators are scrutinizing Bitcoin."}
98
  ]
99
- },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  import json
3
  import gradio as gr
4
  from transformers import pipeline
5
+ import torch
6
 
7
  # Set up logging
8
  logging.basicConfig(
 
96
  {"title": "Bitcoin Price Surges", "description": "Bitcoin's price surged above $30,000."},
97
  {"title": "Bitcoin Faces Challenges", "description": "Regulators are scrutinizing Bitcoin."}
98
  ]
99
+ },
100
+ {
101
+ "coin": "XRP",
102
+ "articles": [
103
+ {"title": "XRP Gains Momentum", "description": "XRP's price rose after a favorable court ruling."},
104
+ {"title": "XRP Faces Uncertainty", "description": "Traders remain cautious about XRP's future."}
105
+ ]
106
+ },
107
+ {
108
+ "coin": "ETH",
109
+ "articles": [
110
+ {"title": "Ethereum Upgrades Network", "description": "Ethereum completed its latest upgrade, improving scalability."},
111
+ {"title": "Ethereum Faces Gas Fee Criticism", "description": "Users complain about high gas fees on Ethereum."}
112
+ ]
113
+ }
114
+ ]
115
+ }"""
116
+ )
117
+
118
+ with gr.Row():
119
+ analyze_button = gr.Button("Analyze Sentiment", size="sm")
120
+
121
+ with gr.Row():
122
+ output_json = gr.JSON(label="Sentiment Results")
123
+
124
+ # Button click handler
125
+ analyze_button.click(
126
+ analyze_sentiment,
127
+ inputs=[input_json],
128
+ outputs=[output_json],
129
+ )
130
+
131
+ # Launch the Gradio app
132
+ logging.info("Launching Gradio interface")
133
+ iface.queue().launch()