File size: 1,375 Bytes
d004b30
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import gradio as gr
import requests
import json


def fetch_data(sqlcmd):
    url = sqlcmd
    
    response = requests.get(url)
    if response.status_code == 200:
        corpdata = response.content.decode('utf-8')

        return corpdata
    else:
        return f"Error: {response.status_code}"

# Gradio UI setup
with gr.Blocks(css="footer {visibility: hidden;} .custom-btn {width: 150px; height: 30px; background-color: lightblue; border-radius: 10px; font-size: 12px; color: #3C82F6;} #header {display: flex; justify-content: space-between; align-items: center; font-size: 24px; font-weight: bold;} #logo {width: 50px; height: 50px;}",title="Create ku-Payload",theme=gr.themes.Glass()) as app:
    gr.Markdown("Create JSON Payload from DB")
    
    with gr.Row():
        fetch_cmd = gr.Textbox(label="Fetch Command", info="https://www.ryhintl.com/dbjson/getjson?sqlcmd=select 法人名,本社所在地,売上高,経常利益又は経常損失,資本金,従業員数,大株主1,大株主2,大株主3,大株主4,大株主5 from corp_info")
        #fetch_corp = gr.Textbox(label="会社名", value="株式会社資生堂")
        fetch_button = gr.Button("ペイロード作成")

    output = gr.Textbox(label="JSONペイロード",max_length=4000)
    
    fetch_button.click(fetch_data, inputs=[fetch_cmd], outputs=output)

app.launch(favicon_path="favicon.ico")