Robert Pardela
commited on
Commit
·
e965785
1
Parent(s):
10b3a00
summay
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
from transformers import pipeline, Conversation
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
chatbot = pipeline(model="Falconsai/medical_summarization")
|
| 5 |
|
| 6 |
message_list = []
|
| 7 |
response_list = []
|
|
@@ -12,7 +12,10 @@ def vanilla_chatbot(message, history):
|
|
| 12 |
|
| 13 |
return conversation.generated_responses[-1]
|
| 14 |
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
# def responseFun(message, history):
|
| 18 |
# return history[len(history) - 1]
|
|
|
|
| 1 |
from transformers import pipeline, Conversation
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
+
chatbot = pipeline("summarization", model="Falconsai/medical_summarization")
|
| 5 |
|
| 6 |
message_list = []
|
| 7 |
response_list = []
|
|
|
|
| 12 |
|
| 13 |
return conversation.generated_responses[-1]
|
| 14 |
|
| 15 |
+
def summarizer_bot(message, history):
|
| 16 |
+
return chatbot(message, min_length=5, max_length=500)[0]['summary_text']
|
| 17 |
+
|
| 18 |
+
demo_chatbot = gr.ChatInterface(summarizer_bot, title="Test medical summarization chatbot", description="Enter text to summarize.")
|
| 19 |
|
| 20 |
# def responseFun(message, history):
|
| 21 |
# return history[len(history) - 1]
|