eshan6704 commited on
Commit
bdcefcc
·
verified ·
1 Parent(s): d8d8f21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -21
app.py CHANGED
@@ -12,11 +12,10 @@ from split import fetch_split
12
  from other import fetch_other
13
  from index import fetch_index
14
 
15
- # --- Main UI function ---
16
  def fetch_data(mode, req_type, name):
17
  req_type = req_type.lower()
18
  symbol = name
19
-
20
  if req_type == "index":
21
  return fetch_index()
22
  elif req_type == "daily":
@@ -42,34 +41,24 @@ def fetch_data(mode, req_type, name):
42
  else:
43
  return f"<h1>No handler for {req_type}</h1>"
44
 
45
- # --- Minimal Clean UI ---
46
  with gr.Blocks() as iface:
47
 
48
- # Inject CSS for compact and taller UI
49
  gr.HTML("""
50
  <style>
51
  .gradio-container { padding-top: 0 !important; }
52
- #topbar { margin: 0; padding: 5px; height: 60px; }
53
  #topbar .gr-input, #topbar .gr-select, #topbar .gr-button {
54
- margin-top: 0 !important;
55
- height: 40px !important; /* Increase input height */
56
- font-size: 16px;
57
  }
58
  </style>
59
  """)
60
 
61
- # Top row with bigger height
62
- with gr.Row(elem_id="topbar", variant="default", gap="small"):
63
- mode_input = gr.Textbox(
64
- label="Mode",
65
- value="stock",
66
- scale=2
67
- )
68
- symbol = gr.Textbox(
69
- label="Stock symbol",
70
- value="PNB",
71
- scale=2
72
- )
73
  req_type = gr.Dropdown(
74
  label="req_type",
75
  choices=[
@@ -87,6 +76,5 @@ with gr.Blocks() as iface:
87
  # Click event
88
  btn.click(fetch_data, inputs=[mode_input, req_type, symbol], outputs=output)
89
 
90
- # --- Launch Server ---
91
  if __name__ == "__main__":
92
  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
  def fetch_data(mode, req_type, name):
16
  req_type = req_type.lower()
17
  symbol = name
18
+
19
  if req_type == "index":
20
  return fetch_index()
21
  elif req_type == "daily":
 
41
  else:
42
  return f"<h1>No handler for {req_type}</h1>"
43
 
 
44
  with gr.Blocks() as iface:
45
 
46
+ # CSS for taller row and bigger components
47
  gr.HTML("""
48
  <style>
49
  .gradio-container { padding-top: 0 !important; }
50
+ #topbar { margin: 0; padding: 5px; height: 60px; display: flex; align-items: center; gap: 10px; }
51
  #topbar .gr-input, #topbar .gr-select, #topbar .gr-button {
52
+ height: 40px !important;
53
+ font-size: 16px;
 
54
  }
55
  </style>
56
  """)
57
 
58
+ # Top row
59
+ with gr.Row(elem_id="topbar"):
60
+ mode_input = gr.Textbox(label="Mode", value="stock", scale=2)
61
+ symbol = gr.Textbox(label="Stock symbol", value="PNB", scale=2)
 
 
 
 
 
 
 
 
62
  req_type = gr.Dropdown(
63
  label="req_type",
64
  choices=[
 
76
  # Click event
77
  btn.click(fetch_data, inputs=[mode_input, req_type, symbol], outputs=output)
78
 
 
79
  if __name__ == "__main__":
80
  iface.launch(server_name="0.0.0.0", server_port=7860)