ShankarC commited on
Commit
bcacd51
·
verified ·
1 Parent(s): 1501574

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ from google import genai
4
+
5
+ def analyze_stock(ticker):
6
+ api_key = os.getenv("GOOGLE_GEMINI_API_KEY")
7
+ if not api_key:
8
+ return "API key not found. Please add it in Space secrets."
9
+
10
+ client = genai.Client(api_key=api_key)
11
+
12
+ prompt = f"Analyze stock {ticker}"
13
+ response = client.models.generate_content(
14
+ model="gemini-2.5-flash-preview-05-20",
15
+ contents=prompt
16
+ )
17
+ return response.text
18
+
19
+ iface = gr.Interface(fn=analyze_stock, inputs="text", outputs="text")
20
+ iface.launch()