Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import requests
|
| 3 |
+
import json
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def fetch_data(sqlcmd):
|
| 7 |
+
url = sqlcmd
|
| 8 |
+
|
| 9 |
+
response = requests.get(url)
|
| 10 |
+
if response.status_code == 200:
|
| 11 |
+
corpdata = response.content.decode('utf-8')
|
| 12 |
+
|
| 13 |
+
return corpdata
|
| 14 |
+
else:
|
| 15 |
+
return f"Error: {response.status_code}"
|
| 16 |
+
|
| 17 |
+
# Gradio UI setup
|
| 18 |
+
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:
|
| 19 |
+
gr.Markdown("Create JSON Payload from DB")
|
| 20 |
+
|
| 21 |
+
with gr.Row():
|
| 22 |
+
fetch_cmd = gr.Textbox(label="Fetch Command", info="https://www.ryhintl.com/dbjson/getjson?sqlcmd=select 法人名,本社所在地,売上高,経常利益又は経常損失,資本金,従業員数,大株主1,大株主2,大株主3,大株主4,大株主5 from corp_info")
|
| 23 |
+
#fetch_corp = gr.Textbox(label="会社名", value="株式会社資生堂")
|
| 24 |
+
fetch_button = gr.Button("ペイロード作成")
|
| 25 |
+
|
| 26 |
+
output = gr.Textbox(label="JSONペイロード",max_length=4000)
|
| 27 |
+
|
| 28 |
+
fetch_button.click(fetch_data, inputs=[fetch_cmd], outputs=output)
|
| 29 |
+
|
| 30 |
+
app.launch(favicon_path="favicon.ico")
|