Update app.py
Browse files
app.py
CHANGED
@@ -236,13 +236,13 @@ def factextraction (message):
|
|
236 |
# 1 seem best for testing
|
237 |
####
|
238 |
#download and setup the model and tokenizer
|
239 |
-
|
240 |
-
tokenizer = BlenderbotTokenizer.from_pretrained(
|
241 |
-
|
242 |
|
243 |
def func (message):
|
244 |
inputs = tokenizer(message, return_tensors="pt")
|
245 |
-
result =
|
246 |
print(result)
|
247 |
return tokenizer.decode(result[0])
|
248 |
|
@@ -416,17 +416,18 @@ sentiment_analysis_result_inputfield = gr.Textbox(label="Sentiment ")
|
|
416 |
topic_sale_inform_result_inputfield = gr.Textbox(label="Thema ")
|
417 |
|
418 |
chat_bot = gr.Interface(fn=callChains ,
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
outputs=[final_answer_inputfield,sentiment_analysis_result_inputfield,topic_sale_inform_result_inputfield],
|
|
|
428 |
# create a public link, set `share=True` in `launch()
|
429 |
-
|
430 |
####################
|
431 |
|
432 |
|
|
|
236 |
# 1 seem best for testing
|
237 |
####
|
238 |
#download and setup the model and tokenizer
|
239 |
+
model_name_chat = 'facebook/blenderbot-400M-distill'
|
240 |
+
tokenizer = BlenderbotTokenizer.from_pretrained(model_name_chat)
|
241 |
+
model_chat = BlenderbotForConditionalGeneration.from_pretrained(model_name_chat)
|
242 |
|
243 |
def func (message):
|
244 |
inputs = tokenizer(message, return_tensors="pt")
|
245 |
+
result = model_chat.generate(**inputs)
|
246 |
print(result)
|
247 |
return tokenizer.decode(result[0])
|
248 |
|
|
|
416 |
topic_sale_inform_result_inputfield = gr.Textbox(label="Thema ")
|
417 |
|
418 |
chat_bot = gr.Interface(fn=callChains ,
|
419 |
+
inputs=[
|
420 |
+
current_message_inputfield,
|
421 |
+
gr.Slider(minimum=1.0,maximum=200.0,value=50.0,step=1,interactive=True,label="max_length"),
|
422 |
+
gr.Slider(minimum=1.0,maximum=20.0,value=1.0,step=1,interactive=True,label="length_penalty"),
|
423 |
+
gr.Slider(minimum=0.0,maximum=5.0,value=3.0,step=1,interactive=True,label="no_repeat_ngram_size"),
|
424 |
+
gr.Slider(minimum=1.0,maximum=20.0,value=1.0,step=1,interactive=True,label="num_beams"),
|
425 |
+
gr.Dropdown(["Deutsch", "Englisch"],value="Deutsch"),
|
426 |
+
],
|
427 |
+
outputs=[final_answer_inputfield,sentiment_analysis_result_inputfield,topic_sale_inform_result_inputfield],
|
428 |
+
title="Conversation Bot with extra")
|
429 |
# create a public link, set `share=True` in `launch()
|
430 |
+
chat_bot.launch()
|
431 |
####################
|
432 |
|
433 |
|