Robert Pardela commited on
Commit
7998dab
1 Parent(s): 8c93f7e
Files changed (2) hide show
  1. app.py +25 -0
  2. requirements.txt +3 -0
app.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from transformers import pipeline, Conversation
2
+ import gradio as gr
3
+
4
+ chatbot = pipeline("text-generation", model="models/epfl-llm/meditron-70b")
5
+
6
+ message_list = []
7
+ response_list = []
8
+
9
+ def vanilla_chatbot(message, history):
10
+ conversation = Conversation(text=message, past_user_inputs=message_list, generated_responses=response_list)
11
+ conversation = chatbot(conversation)
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(vanilla_chatbot, title="Check medical chatbot", description="Enter question")
19
+
20
+ # def responseFun(message, history):
21
+ # return history[len(history) - 1]
22
+
23
+ # demo_chatbot = gr.ChatInterface(responseFun, title="Test medical summarization chatbot", description="Enter text to summarize.")
24
+
25
+ demo_chatbot.launch()
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ gradio==3.39.0
2
+ transformers==4.31.0
3
+ torch==2.0.1