Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
| 1 |
-
# app.py
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
from daily import fetch_daily
|
|
@@ -15,13 +14,8 @@ from index import fetch_index
|
|
| 15 |
|
| 16 |
# --- Main UI function ---
|
| 17 |
def fetch_data(mode, req_type, name):
|
| 18 |
-
"""
|
| 19 |
-
mode: 'stock' or 'index' (currently not used, can be used in future)
|
| 20 |
-
req_type: type of data requested (info, daily, intraday, etc.)
|
| 21 |
-
name: stock symbol or index name
|
| 22 |
-
"""
|
| 23 |
req_type = req_type.lower()
|
| 24 |
-
symbol = name
|
| 25 |
|
| 26 |
if req_type == "index":
|
| 27 |
return fetch_index()
|
|
@@ -51,21 +45,25 @@ def fetch_data(mode, req_type, name):
|
|
| 51 |
# --- Minimal Clean UI ---
|
| 52 |
with gr.Blocks() as iface:
|
| 53 |
|
| 54 |
-
# Inject CSS for compact UI
|
| 55 |
gr.HTML("""
|
| 56 |
<style>
|
| 57 |
.gradio-container { padding-top: 0 !important; }
|
| 58 |
-
#topbar { margin: 0; padding:
|
| 59 |
-
#topbar .gr-input, #topbar .gr-select
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
</style>
|
| 61 |
""")
|
| 62 |
|
| 63 |
-
# Top
|
| 64 |
-
with gr.Row(elem_id="topbar"):
|
| 65 |
mode_input = gr.Textbox(
|
| 66 |
label="Mode",
|
| 67 |
-
value="stock",
|
| 68 |
-
scale=
|
| 69 |
)
|
| 70 |
symbol = gr.Textbox(
|
| 71 |
label="Stock symbol",
|
|
@@ -75,11 +73,11 @@ with gr.Blocks() as iface:
|
|
| 75 |
req_type = gr.Dropdown(
|
| 76 |
label="req_type",
|
| 77 |
choices=[
|
| 78 |
-
|
| 79 |
-
"index","open","preopen","ce","pe","future","bhav","highlow"
|
| 80 |
],
|
| 81 |
value="info",
|
| 82 |
-
scale=
|
| 83 |
)
|
| 84 |
btn = gr.Button("Submit", scale=2)
|
| 85 |
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
from daily import fetch_daily
|
|
|
|
| 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()
|
|
|
|
| 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",
|
|
|
|
| 73 |
req_type = gr.Dropdown(
|
| 74 |
label="req_type",
|
| 75 |
choices=[
|
| 76 |
+
"info","intraday","daily","qresult","result","balance","cashflow",
|
| 77 |
+
"dividend","split","index","open","preopen","ce","pe","future","bhav","highlow"
|
| 78 |
],
|
| 79 |
value="info",
|
| 80 |
+
scale=3
|
| 81 |
)
|
| 82 |
btn = gr.Button("Submit", scale=2)
|
| 83 |
|