Spaces:
Sleeping
Sleeping
Create DialoGPT
Browse files
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()
|