YKajima commited on
Commit
022b0f7
·
verified ·
1 Parent(s): ee2be61

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -8,7 +8,7 @@ def greet(name):
8
  return "こんにちは " + name + "さん!! \n僕はパスカルくんだよ。よろしくね"
9
 
10
 
11
- def summarize(text: str):
12
  _prompt = f"""
13
  以下の文章を要約してください。
14
  {text}
@@ -29,12 +29,14 @@ def summarize(text: str):
29
  config=config
30
  )
31
 
32
- return film.run()
33
 
34
 
35
  def chat(text):
36
- summary = summarize(text)
37
- return summary
 
 
38
 
39
 
40
  iface = gr.Interface(fn=chat, inputs="text", outputs="text")
 
8
  return "こんにちは " + name + "さん!! \n僕はパスカルくんだよ。よろしくね"
9
 
10
 
11
+ async def summarize(text: str):
12
  _prompt = f"""
13
  以下の文章を要約してください。
14
  {text}
 
29
  config=config
30
  )
31
 
32
+ return await film.run()
33
 
34
 
35
  def chat(text):
36
+ loop = asyncio.new_event_loop()
37
+ summary = loop.run_until_complete(summarize(text))
38
+ loop.close()
39
+ return await summary
40
 
41
 
42
  iface = gr.Interface(fn=chat, inputs="text", outputs="text")