Spaces:
No application file
No application file
Create app.py
#1
by JIIDOW - opened
app.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
chatbot = pipeline("text-generation", model="gpt2")
|
| 5 |
+
|
| 6 |
+
def repondre(question):
|
| 7 |
+
reponse = chatbot(question, max_length=50)
|
| 8 |
+
return reponse[0]["generated_text"]
|
| 9 |
+
|
| 10 |
+
interface = gr.Interface(
|
| 11 |
+
fn=repondre,
|
| 12 |
+
inputs="text",
|
| 13 |
+
outputs="text",
|
| 14 |
+
title="Mon site IA"
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
interface.launch()
|