rajat5ranjan commited on
Commit
6fa996a
·
verified ·
1 Parent(s): b9c076d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+
3
+ import gradio as gr
4
+ from core.stock_analysis import analyze_stock
5
+ from langchain_google_genai import ChatGoogleGenerativeAI
6
+ import os
7
+
8
+ GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
9
+ llm = ChatGoogleGenerativeAI(model="gemini-2.5-pro", google_api_key=GOOGLE_API_KEY)
10
+
11
+ def analyze_api(ticker):
12
+ return analyze_stock(ticker.strip().upper(), llm)
13
+
14
+ demo = gr.Interface(
15
+ fn=analyze_api,
16
+ inputs=gr.Textbox(label="Enter NSE Ticker (e.g., RELIANCE)"),
17
+ outputs="json",
18
+ title="📈 Stock Analysis API (NSE)",
19
+ description="Get analysis and insights for Indian stocks using Google Gemini + LangChain. Returns structured JSON."
20
+ )
21
+
22
+ if __name__ == "__main__":
23
+ demo.queue().launch()