Spaces:
Sleeping
Sleeping
yuhei_kajima
commited on
Commit
•
4991a9b
1
Parent(s):
33c1a1e
Add SpiralFilm
Browse files- app.py +32 -2
- requirements.txt +1 -0
app.py
CHANGED
@@ -1,12 +1,42 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
|
4 |
def greet(name):
|
5 |
return "こんにちは " + name + "さん!! \n僕はパスカルくんだよ"
|
6 |
|
7 |
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
|
11 |
if __name__ == "__main__":
|
12 |
-
iface.launch(auth=("
|
|
|
1 |
import gradio as gr
|
2 |
+
from spiralfilm import FilmCore, FilmConfig
|
3 |
|
4 |
|
5 |
def greet(name):
|
6 |
return "こんにちは " + name + "さん!! \n僕はパスカルくんだよ"
|
7 |
|
8 |
|
9 |
+
def summarize(text: str):
|
10 |
+
_prompt = f"""
|
11 |
+
以下の文章を要約してください。
|
12 |
+
{text}
|
13 |
+
"""
|
14 |
+
|
15 |
+
config = FilmConfig(
|
16 |
+
model_name="gpt-3.5-turbo",
|
17 |
+
api_type="azure",
|
18 |
+
azure_deployment_id="gpt-35-turbo",
|
19 |
+
azure_api_version="2023-05-15",
|
20 |
+
timeout=60.0, # これを入れないとtimeoutが頻繁に発生する
|
21 |
+
)
|
22 |
+
config.get_api_key()
|
23 |
+
|
24 |
+
film = FilmCore(
|
25 |
+
prompt=_prompt,
|
26 |
+
system_prompt="あなたは優秀なライターです。",
|
27 |
+
config=config
|
28 |
+
)
|
29 |
+
|
30 |
+
return film.run()
|
31 |
+
|
32 |
+
|
33 |
+
def chat(text):
|
34 |
+
summary = summarize(text)
|
35 |
+
return summary
|
36 |
+
|
37 |
+
|
38 |
+
iface = gr.Interface(fn=chat, inputs="text", outputs="text")
|
39 |
|
40 |
|
41 |
if __name__ == "__main__":
|
42 |
+
iface.launch(auth=("spiralai", "spiralai"))
|
requirements.txt
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
SpiralFilm==0.2.5
|