Update app.py
Browse files
app.py
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
import random
|
|
|
2 |
|
3 |
def get_fortune():
|
4 |
fortunes = [
|
@@ -13,13 +14,16 @@ def get_fortune():
|
|
13 |
|
14 |
return random.choice(fortunes)
|
15 |
|
16 |
-
def
|
17 |
-
user_name = input("あなたのお名前を教えてください: ")
|
18 |
-
print(f"\n{user_name}さんの今日の運勢を占います...")
|
19 |
-
input("エンターキーを押してください。")
|
20 |
-
|
21 |
fortune_result = get_fortune()
|
22 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
main()
|
|
|
1 |
import random
|
2 |
+
import gradio as gr
|
3 |
|
4 |
def get_fortune():
|
5 |
fortunes = [
|
|
|
14 |
|
15 |
return random.choice(fortunes)
|
16 |
|
17 |
+
def fortune_teller(name):
|
|
|
|
|
|
|
|
|
18 |
fortune_result = get_fortune()
|
19 |
+
return f"{name}さんの今日の運勢は:{fortune_result}"
|
20 |
+
|
21 |
+
iface = gr.Interface(
|
22 |
+
fn=fortune_teller,
|
23 |
+
inputs="text",
|
24 |
+
outputs="text",
|
25 |
+
live=True,
|
26 |
+
title="今日の運勢占い"
|
27 |
+
)
|
28 |
|
29 |
+
iface.launch()
|
|