File size: 640 Bytes
d92bb67
 
 
 
008ef88
 
d92bb67
 
 
 
 
4a05a99
 
d92bb67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr

from krwordrank.word import summarize_with_keywords

# import pip
# pip.main(['install', 'krwordrank'])


# main
def inference(prompt):

    prompt = prompt.split('\n')

    keywords = summarize_with_keywords(
        prompt, 
        min_count=5, 
        max_length=10,
        beta=0.85, 
        max_iter=10, 
        verbose=True
    )
    #keywords = summarize_with_keywords(prompt)

    return keywords


demo = gr.Interface(
    fn=inference, 
    inputs="text", 
    outputs="text" #return ๊ฐ’
    ).launch() # launch(share=True)๋ฅผ ์„ค์ •ํ•˜๋ฉด ์™ธ๋ถ€์—์„œ ์ ‘์† ๊ฐ€๋Šฅํ•œ ๋งํฌ๊ฐ€ ์ƒ์„ฑ๋จ

demo.launch()