rajat5ranjan commited on
Commit
cf4ecc3
·
verified ·
1 Parent(s): 69b8b9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -1
app.py CHANGED
@@ -33,7 +33,7 @@ if ticker_user!="":
33
 
34
  loader = WebBaseLoader([url1,url2])
35
  docs = loader.load()
36
-
37
 
38
  st.divider()
39
  # llm_prompt_template = """You are an expert Stock Market Trader for stock market insights based on fundamental, analytical, profit based and company financials.
@@ -67,10 +67,42 @@ if ticker_user!="":
67
 
68
 
69
  res = stuff_chain.invoke(docs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  st.success('Response')
72
  st.write(res["output_text"])
73
 
 
 
 
 
 
74
  # If there is no environment variable set for the API key, you can pass the API
75
  # key to the parameter `google_api_key` of the `GoogleGenerativeAIEmbeddings`
76
  # function: `google_api_key = "key"`.
 
33
 
34
  loader = WebBaseLoader([url1,url2])
35
  docs = loader.load()
36
+
37
 
38
  st.divider()
39
  # llm_prompt_template = """You are an expert Stock Market Trader for stock market insights based on fundamental, analytical, profit based and company financials.
 
67
 
68
 
69
  res = stuff_chain.invoke(docs)
70
+
71
+ import requests
72
+
73
+ url = "https://api.chart-img.com/v2/tradingview/advanced-chart"
74
+ api_key = "l0iUFRSeqC9z7nDPTd1hnafPh2RrdcEy6rl6tNqV"
75
+ headers = {
76
+ "x-api-key": api_key,
77
+ "content-type": "application/json"
78
+ }
79
+ data = {
80
+ "height": 400,
81
+ "theme": "light",
82
+ "interval": "1D",
83
+ "session": "extended",
84
+ "symbol": f"NSE:{ticker_user}"
85
+ }
86
+
87
+ response = requests.post(url, headers=headers, json=data)
88
+
89
+ if response.status_code == 200:
90
+ with open("chart_t1.jpg", "wb") as f:
91
+ f.write(response.content)
92
+ st.image("chart_t1.jpg", caption='')
93
+ # print("Image saved as chart-img-02.png")
94
+ else:
95
+ print(f"Failed to retrieve image. Status code: {response.status_code}")
96
+ print("Response:", response.text)
97
 
98
  st.success('Response')
99
  st.write(res["output_text"])
100
 
101
+
102
+
103
+
104
+
105
+
106
  # If there is no environment variable set for the API key, you can pass the API
107
  # key to the parameter `google_api_key` of the `GoogleGenerativeAIEmbeddings`
108
  # function: `google_api_key = "key"`.