semlinkoxcampaign commited on
Commit
2d05b53
·
verified ·
1 Parent(s): ce738ac

Create DialoGPT

Browse files
Files changed (1) hide show
  1. DialoGPT +14 -0
DialoGPT ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Charger le modèle préexistant
5
+ chatbot = pipeline("conversational", model="microsoft/DialoGPT-medium")
6
+
7
+ # Fonction qui gère la réponse du chatbot
8
+ def chatbot_response(message):
9
+ response = chatbot(message)
10
+ return response[0]['generated_text']
11
+
12
+ # Interface Gradio
13
+ iface = gr.Interface(fn=chatbot_response, inputs="text", outputs="text")
14
+ iface.launch()