Chris4K commited on
Commit
e6e2efa
1 Parent(s): e1929b8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -14
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
- model_name = 'facebook/blenderbot-400M-distill'
240
- tokenizer = BlenderbotTokenizer.from_pretrained(model_name)
241
- model = BlenderbotForConditionalGeneration.from_pretrained(model_name)
242
 
243
  def func (message):
244
  inputs = tokenizer(message, return_tensors="pt")
245
- result = model.generate(**inputs)
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
- 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], title="Conversation Bot with extra")
 
428
  # create a public link, set `share=True` in `launch()
429
- #chat_bot.launch()
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