Update app.py
Browse files
app.py
CHANGED
@@ -1,44 +1,40 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
import numpy as np
|
4 |
-
from PIL import Image
|
5 |
|
6 |
-
def
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
""
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
def process_images(image_files):
|
27 |
-
"""
|
28 |
-
업로드된 이미지 파일들을 처리하여 비디오를 생성합니다.
|
29 |
-
"""
|
30 |
-
images = [imageio.v3.imread(image_file) for image_file in image_files]
|
31 |
-
video_file = create_video(images)
|
32 |
-
return video_file
|
33 |
-
|
34 |
-
# Gradio 인터페이스 정의
|
35 |
-
iface = gr.Interface(
|
36 |
-
fn=process_images,
|
37 |
-
inputs=gr.File(label="Upload Images", type="file", multiple_files=True), # 수정된 부분
|
38 |
-
outputs="file",
|
39 |
-
title="Image to Video Converter",
|
40 |
-
description="Upload multiple images to create a video."
|
41 |
-
)
|
42 |
|
43 |
# Gradio 앱 실행
|
44 |
-
|
|
|
1 |
import gradio as gr
|
2 |
+
import requests
|
|
|
|
|
3 |
|
4 |
+
def get_lunar_info(year, month, day, time):
|
5 |
+
# API URL 설정
|
6 |
+
url = "https://api.example.com/get_lunar_info"
|
7 |
+
|
8 |
+
# API에 전달할 데이터 설정
|
9 |
+
data = {
|
10 |
+
"year": year,
|
11 |
+
"month": month,
|
12 |
+
"day": day,
|
13 |
+
"time": time
|
14 |
+
}
|
15 |
+
|
16 |
+
# API 호출
|
17 |
+
response = requests.post(url, json=data)
|
18 |
+
|
19 |
+
# API 응답 확인 및 결과 반환
|
20 |
+
if response.status_code == 200:
|
21 |
+
return response.json()
|
22 |
+
else:
|
23 |
+
return "API 호출에 실패했습니다."
|
24 |
|
25 |
+
# Gradio 인터페이스 구성
|
26 |
+
with gr.Blocks() as demo:
|
27 |
+
gr.Markdown("### 생년월일 및 생시 정보 입력")
|
28 |
+
year = gr.Textbox(label="생년(예: 1990)")
|
29 |
+
month = gr.Textbox(label="생월(예: 01)")
|
30 |
+
day = gr.Textbox(label="생일(예: 31)")
|
31 |
+
time = gr.Textbox(label="생시(예시: 1030)")
|
32 |
+
|
33 |
+
submit_button = gr.Button("정보 제출")
|
34 |
+
|
35 |
+
result = gr.Textbox(label="결과")
|
36 |
+
|
37 |
+
submit_button.click(fn=get_lunar_info, inputs=[year, month, day, time], outputs=result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
# Gradio 앱 실행
|
40 |
+
demo.launch()
|