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()