Spaces:
Sleeping
Sleeping
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()
|