Spaces:
Sleeping
Sleeping
File size: 1,089 Bytes
145ad7d f7f4bea ec5aa0b f7f4bea c78b25e f7f4bea 89ea00c 69279bb f7f4bea |
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 32 33 34 35 36 37 38 39 40 |
import gradio as gr
import requests
def get_lunar_info(year, month, day, time):
# API URL ์ค์
url = "https://api.example.com/get_lunar_info"
# API์ ์ ๋ฌํ ๋ฐ์ดํฐ ์ค์
data = {
"year": year,
"month": month,
"day": day,
"time": time
}
# API ํธ์ถ
response = requests.post(url, json=data)
# API ์๋ต ํ์ธ ๋ฐ ๊ฒฐ๊ณผ ๋ฐํ
if response.status_code == 200:
return response.json()
else:
return "API ํธ์ถ์ ์คํจํ์ต๋๋ค."
# Gradio ์ธํฐํ์ด์ค ๊ตฌ์ฑ
with gr.Blocks() as demo:
gr.Markdown("### ์๋
์์ผ ๋ฐ ์์ ์ ๋ณด ์
๋ ฅ")
year = gr.Textbox(label="์๋
(์: 1990)")
month = gr.Textbox(label="์์(์: 01)")
day = gr.Textbox(label="์์ผ(์: 31)")
time = gr.Textbox(label="์์(์์: 1030)")
submit_button = gr.Button("์ ๋ณด ์ ์ถ")
result = gr.Textbox(label="๊ฒฐ๊ณผ")
submit_button.click(fn=get_lunar_info, inputs=[year, month, day, time], outputs=result)
# Gradio ์ฑ ์คํ
demo.launch() |