Spaces:
Sleeping
Sleeping
Commit
·
85dc520
1
Parent(s):
d0bd6d0
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,14 +4,14 @@ import requests
|
|
| 4 |
|
| 5 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 6 |
|
| 7 |
-
manual_url = "https://script.google.com/macros/s/AKfycbzlFFMNw0Zc7IKt4Sn7KB5qggPMlh_2mdMn5uOjw93MF2L-58SPb4ZPUQKHJppLSLBi/exec"
|
| 8 |
manual_content = None
|
| 9 |
|
| 10 |
def get_manual_content():
|
| 11 |
-
global manual_content
|
| 12 |
-
response = requests.get(manual_url)
|
| 13 |
-
if response.status_code == 200:
|
| 14 |
-
|
| 15 |
|
| 16 |
def format_prompt(message, history):
|
| 17 |
global manual_content
|
|
@@ -23,7 +23,7 @@ def format_prompt(message, history):
|
|
| 23 |
for user_prompt, bot_response in history:
|
| 24 |
prompt += f"[INST] {user_prompt} [/INST]"
|
| 25 |
prompt += f" {bot_response}</s> "
|
| 26 |
-
prompt += f"[INST]Tu sei
|
| 27 |
return prompt
|
| 28 |
|
| 29 |
def generate(
|
|
@@ -54,12 +54,12 @@ def generate(
|
|
| 54 |
return output
|
| 55 |
|
| 56 |
mychatbot = gr.Chatbot(
|
| 57 |
-
avatar_images=["./user.png", "./
|
| 58 |
|
| 59 |
demo = gr.ChatInterface(fn=generate,
|
| 60 |
chatbot=mychatbot,
|
| 61 |
-
title="
|
| 62 |
-
textbox=gr.Textbox(placeholder="
|
| 63 |
theme="gradio/base",
|
| 64 |
submit_btn="Invia",
|
| 65 |
retry_btn=None,
|
|
|
|
| 4 |
|
| 5 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 6 |
|
| 7 |
+
#manual_url = "https://script.google.com/macros/s/AKfycbzlFFMNw0Zc7IKt4Sn7KB5qggPMlh_2mdMn5uOjw93MF2L-58SPb4ZPUQKHJppLSLBi/exec"
|
| 8 |
manual_content = None
|
| 9 |
|
| 10 |
def get_manual_content():
|
| 11 |
+
# global manual_content
|
| 12 |
+
# response = requests.get(manual_url)
|
| 13 |
+
# if response.status_code == 200:
|
| 14 |
+
manual_content = '[INST]Per il compito di matematica devi seguire il PDF su Classroom[/INST]'
|
| 15 |
|
| 16 |
def format_prompt(message, history):
|
| 17 |
global manual_content
|
|
|
|
| 23 |
for user_prompt, bot_response in history:
|
| 24 |
prompt += f"[INST] {user_prompt} [/INST]"
|
| 25 |
prompt += f" {bot_response}</s> "
|
| 26 |
+
prompt += f"[INST]Tu sei Bonsi AI, il mio professore/assistente personale della scuola A.F.G.P. Bonsignori di Remedello. Io sono uno studente e ho bisogno di aiuto, tu rispondi in merito al manuale e istruzioni che hai ricevuto: {message} [/INST]"
|
| 27 |
return prompt
|
| 28 |
|
| 29 |
def generate(
|
|
|
|
| 54 |
return output
|
| 55 |
|
| 56 |
mychatbot = gr.Chatbot(
|
| 57 |
+
avatar_images=["./user.png", "./bonsi.jpg"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True,value=[[None, "Ciao sono Bonsi AI il tuo assistente personale del centro di formazione Bonsignori di Remedello"]], )
|
| 58 |
|
| 59 |
demo = gr.ChatInterface(fn=generate,
|
| 60 |
chatbot=mychatbot,
|
| 61 |
+
title="Bonsi AI 🪴",
|
| 62 |
+
textbox=gr.Textbox(placeholder="Cosa posso fare per te, studente..."),
|
| 63 |
theme="gradio/base",
|
| 64 |
submit_btn="Invia",
|
| 65 |
retry_btn=None,
|