eshan6704 commited on
Commit
984b382
·
verified ·
1 Parent(s): 9853231

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -9
app.py CHANGED
@@ -12,6 +12,9 @@ from split import fetch_split
12
  from other import fetch_other
13
  from index import fetch_index
14
 
 
 
 
15
  def fetch_data(mode, req_type, name):
16
  req_type = req_type.lower()
17
  symbol = name
@@ -41,24 +44,24 @@ def fetch_data(mode, req_type, name):
41
  else:
42
  return f"<h1>No handler for {req_type}</h1>"
43
 
 
 
 
44
  with gr.Blocks() as iface:
45
 
46
- # CSS for horizontal top bar, spacing, full visibility
47
- gr.HTML(
48
- # Top inputs in horizontal block (use Blocks, not Block)
49
- with gr.Blocks(elem_id="topblock"):
50
- mode_input = gr.Textbox(label="Mode", value="stock", scale=2, placeholder="Mode")
51
- symbol = gr.Textbox(label="Stock symbol", value="PNB", scale=2, placeholder="Symbol")
52
  req_type = gr.Dropdown(
53
  label="req_type",
54
  choices=[
55
  "info","intraday","daily","qresult","result","balance","cashflow",
56
  "dividend","split","index","open","preopen","ce","pe","future","bhav","highlow"
57
  ],
58
- value="info",
59
- scale=3
60
  )
61
- btn = gr.Button("Submit", scale=2)
62
 
63
  # Output area
64
  output = gr.HTML()
@@ -66,5 +69,8 @@ with gr.Blocks() as iface:
66
  # Click event
67
  btn.click(fetch_data, inputs=[mode_input, req_type, symbol], outputs=output)
68
 
 
 
 
69
  if __name__ == "__main__":
70
  iface.launch(server_name="0.0.0.0", server_port=7860)
 
12
  from other import fetch_other
13
  from index import fetch_index
14
 
15
+ # -----------------------------
16
+ # Data fetch function
17
+ # -----------------------------
18
  def fetch_data(mode, req_type, name):
19
  req_type = req_type.lower()
20
  symbol = name
 
44
  else:
45
  return f"<h1>No handler for {req_type}</h1>"
46
 
47
+ # -----------------------------
48
+ # Gradio UI (default styling)
49
+ # -----------------------------
50
  with gr.Blocks() as iface:
51
 
52
+ # Top inputs
53
+ with gr.Blocks():
54
+ mode_input = gr.Textbox(label="Mode", value="stock", placeholder="Mode")
55
+ symbol = gr.Textbox(label="Stock symbol", value="PNB", placeholder="Symbol")
 
 
56
  req_type = gr.Dropdown(
57
  label="req_type",
58
  choices=[
59
  "info","intraday","daily","qresult","result","balance","cashflow",
60
  "dividend","split","index","open","preopen","ce","pe","future","bhav","highlow"
61
  ],
62
+ value="info"
 
63
  )
64
+ btn = gr.Button("Submit")
65
 
66
  # Output area
67
  output = gr.HTML()
 
69
  # Click event
70
  btn.click(fetch_data, inputs=[mode_input, req_type, symbol], outputs=output)
71
 
72
+ # -----------------------------
73
+ # Launch server
74
+ # -----------------------------
75
  if __name__ == "__main__":
76
  iface.launch(server_name="0.0.0.0", server_port=7860)