Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
|
@@ -2,7 +2,7 @@ from crewai import Crew
|
|
| 2 |
from textwrap import dedent
|
| 3 |
import json
|
| 4 |
|
| 5 |
-
from crypto_analysis_agents import
|
| 6 |
from crypto_analysis_tasks import CryptoAnalysisTasks
|
| 7 |
|
| 8 |
class CryptoCrew:
|
|
@@ -10,7 +10,7 @@ class CryptoCrew:
|
|
| 10 |
self.crypto = crypto
|
| 11 |
|
| 12 |
def run(self):
|
| 13 |
-
agents =
|
| 14 |
tasks = CryptoAnalysisTasks()
|
| 15 |
|
| 16 |
market_analyst_agent = agents.market_analyst()
|
|
@@ -39,13 +39,11 @@ class CryptoCrew:
|
|
| 39 |
|
| 40 |
result = crew.kickoff()
|
| 41 |
|
| 42 |
-
# Parse the result to extract structured data
|
| 43 |
parsed_result = self.parse_result(result)
|
| 44 |
|
| 45 |
return parsed_result
|
| 46 |
|
| 47 |
def parse_result(self, result):
|
| 48 |
-
# This is a simple parser. You might need to adjust it based on the actual structure of your result
|
| 49 |
parsed = {
|
| 50 |
"summary": result,
|
| 51 |
"sentiment": {
|
|
@@ -56,7 +54,6 @@ class CryptoCrew:
|
|
| 56 |
}
|
| 57 |
}
|
| 58 |
|
| 59 |
-
# Extract sentiment information
|
| 60 |
if "sentiment score" in result.lower():
|
| 61 |
sentiment_section = result.split("sentiment score")[1].split("\n")[0]
|
| 62 |
try:
|
|
@@ -68,8 +65,6 @@ class CryptoCrew:
|
|
| 68 |
except:
|
| 69 |
pass
|
| 70 |
|
| 71 |
-
# You can add more parsing logic here to extract other structured data
|
| 72 |
-
|
| 73 |
return parsed
|
| 74 |
|
| 75 |
if __name__ == "__main__":
|
|
|
|
| 2 |
from textwrap import dedent
|
| 3 |
import json
|
| 4 |
|
| 5 |
+
from crypto_analysis_agents import CryptoAnalysisAgents
|
| 6 |
from crypto_analysis_tasks import CryptoAnalysisTasks
|
| 7 |
|
| 8 |
class CryptoCrew:
|
|
|
|
| 10 |
self.crypto = crypto
|
| 11 |
|
| 12 |
def run(self):
|
| 13 |
+
agents = CryptoAnalysisAgents()
|
| 14 |
tasks = CryptoAnalysisTasks()
|
| 15 |
|
| 16 |
market_analyst_agent = agents.market_analyst()
|
|
|
|
| 39 |
|
| 40 |
result = crew.kickoff()
|
| 41 |
|
|
|
|
| 42 |
parsed_result = self.parse_result(result)
|
| 43 |
|
| 44 |
return parsed_result
|
| 45 |
|
| 46 |
def parse_result(self, result):
|
|
|
|
| 47 |
parsed = {
|
| 48 |
"summary": result,
|
| 49 |
"sentiment": {
|
|
|
|
| 54 |
}
|
| 55 |
}
|
| 56 |
|
|
|
|
| 57 |
if "sentiment score" in result.lower():
|
| 58 |
sentiment_section = result.split("sentiment score")[1].split("\n")[0]
|
| 59 |
try:
|
|
|
|
| 65 |
except:
|
| 66 |
pass
|
| 67 |
|
|
|
|
|
|
|
| 68 |
return parsed
|
| 69 |
|
| 70 |
if __name__ == "__main__":
|