Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -1,40 +1,27 @@
|
|
1 |
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
|
4 |
-
|
5 |
-
#gr.Interface.from_pipeline(pipe).launch()
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
description = "Legal Document Drafting with BLOOM"
|
11 |
-
api_key="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"
|
12 |
-
examples=[
|
13 |
-
["闕很大明知金融帳戶之存摺、提款卡及密碼係供自己使用之重要理財工具,"],
|
14 |
-
["森上梅前明知其無資力支付酒店消費,亦無付款意願,竟意圖為自己不法之所有,"]
|
15 |
]
|
16 |
|
17 |
-
|
18 |
"huggingface/jslin09/bloom-560m-finetuned-fraud",
|
19 |
-
title=
|
20 |
-
|
21 |
-
|
22 |
-
gr.Slider(10, 200, step=10, value=100), # token_count
|
23 |
-
gr.Slider(0.2, 2.0, step=0.1, value=1.0), # temperature
|
24 |
-
gr.Slider(0.0, 1.0, step=0.05, value=0.8), # top_p
|
25 |
-
gr.Slider(0.0, 1.0, step=0.1, value=0.1), # presencePenalty
|
26 |
-
gr.Slider(0.0, 1.0, step=0.1, value=0.1), # countPenalty
|
27 |
-
],
|
28 |
-
outputs=gr.Textbox(label="生成的草稿", lines=28),
|
29 |
-
description=description,
|
30 |
-
examples=examples,
|
31 |
-
api_key=api_key,
|
32 |
)
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
title=
|
|
|
|
|
37 |
)
|
38 |
|
39 |
-
demo.
|
40 |
-
|
|
|
|
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
+
title = "Legal Document Drafting"
|
|
|
4 |
|
5 |
+
drafting_examples = [
|
6 |
+
["闕很大明知金融帳戶之存摺、提款卡及密碼係供自己使用之重要理財工具,"],
|
7 |
+
["森上梅前明知其無資力支付酒店消費,亦無付款意願,竟意圖為自己不法之所有,"]
|
|
|
|
|
|
|
|
|
|
|
8 |
]
|
9 |
|
10 |
+
dreating_demo = gr.Interface.load(
|
11 |
"huggingface/jslin09/bloom-560m-finetuned-fraud",
|
12 |
+
title=None,
|
13 |
+
examples=drafting_examples,
|
14 |
+
description="Give me something to say!",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
)
|
16 |
|
17 |
+
stt_demo = gr.Interface.load(
|
18 |
+
"huggingface/jslin09/bloom-560m-finetuned-fraud",
|
19 |
+
title=None,
|
20 |
+
inputs="森上梅前明知其無資力支付酒店消費,亦無付款意願,竟意圖為自己不法之所有,",
|
21 |
+
description="Let me try to guess what you're saying!",
|
22 |
)
|
23 |
|
24 |
+
demo = gr.TabbedInterface([dreating_demo, stt_demo], ["Verdicts Drafting", "Speech-to-text"])
|
25 |
+
|
26 |
+
if __name__ == "__main__":
|
27 |
+
demo.launch()
|