Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Charger le modèle de génération de texte
|
5 |
+
@st.cache_resource
|
6 |
+
def load_model():
|
7 |
+
return pipeline("text-generation", model="mistralai/Mistral-7B-Instruct-v0.1")
|
8 |
+
|
9 |
+
bot = load_model()
|
10 |
+
|
11 |
+
# Interface du chatbot
|
12 |
+
st.title("Chatbot Restaurant 🍽️")
|
13 |
+
st.write("Posez vos questions sur le restaurant !")
|
14 |
+
|
15 |
+
user_input = st.text_input("Votre question :")
|
16 |
+
|
17 |
+
if user_input:
|
18 |
+
response = bot(user_input, max_length=200, do_sample=True)[0]["generated_text"]
|
19 |
+
st.write(response)
|