12 fix docs #13
@@ -42,6 +42,6 @@ if __name__ == "__main__":
|
|||||||
analyze_btn = gr.Button("🔎 Analizza")
|
analyze_btn = gr.Button("🔎 Analizza")
|
||||||
analyze_btn.click(fn=pipeline.interact, inputs=[user_input], outputs=output)
|
analyze_btn.click(fn=pipeline.interact, inputs=[user_input], outputs=output)
|
||||||
|
|
||||||
server, port = ("0.0.0.0", 8000)
|
server, port = ("127.0.0.1", 8000)
|
||||||
log_info(f"Starting UPO AppAI on http://{server}:{port}")
|
log_info(f"Starting UPO AppAI on http://{server}:{port}")
|
||||||
demo.launch(server_name=server, server_port=port, quiet=True)
|
demo.launch(server_name=server, server_port=port, quiet=True)
|
||||||
|
|||||||
@@ -49,10 +49,10 @@ class CoinBaseWrapper(BaseWrapper):
|
|||||||
|
|
||||||
def __init__(self, currency: str = "USD"):
|
def __init__(self, currency: str = "USD"):
|
||||||
api_key = os.getenv("COINBASE_API_KEY")
|
api_key = os.getenv("COINBASE_API_KEY")
|
||||||
assert api_key is not None, "API key is required"
|
assert api_key, "COINBASE_API_KEY environment variable not set"
|
||||||
|
|
||||||
api_private_key = os.getenv("COINBASE_API_SECRET")
|
api_private_key = os.getenv("COINBASE_API_SECRET")
|
||||||
assert api_private_key is not None, "API private key is required"
|
assert api_private_key, "COINBASE_API_SECRET environment variable not set"
|
||||||
|
|
||||||
self.currency = currency
|
self.currency = currency
|
||||||
self.client: RESTClient = RESTClient(
|
self.client: RESTClient = RESTClient(
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ class CryptoCompareWrapper(BaseWrapper):
|
|||||||
"""
|
"""
|
||||||
def __init__(self, currency:str='USD'):
|
def __init__(self, currency:str='USD'):
|
||||||
api_key = os.getenv("CRYPTOCOMPARE_API_KEY")
|
api_key = os.getenv("CRYPTOCOMPARE_API_KEY")
|
||||||
assert api_key is not None, "API key is required"
|
assert api_key, "CRYPTOCOMPARE_API_KEY environment variable not set"
|
||||||
|
|
|||||||
|
|
||||||
self.api_key = api_key
|
self.api_key = api_key
|
||||||
self.currency = currency
|
self.currency = currency
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class NewsApiWrapper(NewsWrapper):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
api_key = os.getenv("NEWS_API_KEY")
|
api_key = os.getenv("NEWS_API_KEY")
|
||||||
assert api_key is not None, "NEWS_API_KEY environment variable not set"
|
assert api_key, "NEWS_API_KEY environment variable not set"
|
||||||
|
|
||||||
self.client = newsapi.NewsApiClient(api_key=api_key)
|
self.client = newsapi.NewsApiClient(api_key=api_key)
|
||||||
self.category = "business" # Cryptocurrency is under business
|
self.category = "business" # Cryptocurrency is under business
|
||||||
|
|||||||
@@ -51,10 +51,10 @@ class RedditWrapper(SocialWrapper):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
client_id = os.getenv("REDDIT_API_CLIENT_ID")
|
client_id = os.getenv("REDDIT_API_CLIENT_ID")
|
||||||
assert client_id is not None, "REDDIT_API_CLIENT_ID environment variable is not set"
|
assert client_id, "REDDIT_API_CLIENT_ID environment variable is not set"
|
||||||
|
|
||||||
client_secret = os.getenv("REDDIT_API_CLIENT_SECRET")
|
client_secret = os.getenv("REDDIT_API_CLIENT_SECRET")
|
||||||
assert client_secret is not None, "REDDIT_API_CLIENT_SECRET environment variable is not set"
|
assert client_secret, "REDDIT_API_CLIENT_SECRET environment variable is not set"
|
||||||
|
|
||||||
self.tool = Reddit(
|
self.tool = Reddit(
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
|
|||||||
Reference in New Issue
Block a user
Using assertions for API validation is not recommended in production code. Consider raising a more specific exception like
ValueErrororAPIDataErrorinstead.