Spaces:
Sleeping
Sleeping
Commit ·
85dc520
1
Parent(s): d0bd6d0
Update app.py
Browse files3 unmodified lines45678910111213141516175 unmodified lines2324252627282924 unmodified lines5455565758596061626364653 unmodified linesclient = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")manual_url = "https://script.google.com/macros/s/AKfycbzlFFMNw0Zc7IKt4Sn7KB5qggPMlh_2mdMn5uOjw93MF2L-58SPb4ZPUQKHJppLSLBi/exec"manual_content = Nonedef get_manual_content():global manual_contentresponse = requests.get(manual_url)if response.status_code == 200:manual_content = response.textdef format_prompt(message, history):global manual_content5 unmodified linesfor user_prompt, bot_response in history:prompt += f"[INST] {user_prompt} [/INST]"prompt += f" {bot_response}</s> "prompt += f"[INST]Tu sei Zucchetti AI, il mio assistente personale di AdHoc e... io ho un problema in AdHoc, rispondi proponendo SOLO con soluzione relativa al problema a partire dal manuale: {message} [/INST]"return promptdef generate(24 unmodified linesreturn outputmychatbot = gr.Chatbot(avatar_images=["./user.png", "./LogoAHR.jpg"], bubble_full_width=False, show_label=False, show_copy_button=True, likeable=True,value=[[None, "Ciao sono Zucchetti AI il tuo assistente personale per AdHoc Revolution…"]], )demo = gr.ChatInterface(fn=generate,chatbot=mychatbot,title="Zucchetti AI",textbox=gr.Textbox(placeholder="Descrivi il tuo problema..."),theme="gradio/base",submit_btn="Invia",retry_btn=None,3 unmodified lines45678910111213141516175 unmodified lines2324252627282924 unmodified lines5455565758596061626364653 unmodified linesclient = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")#manual_url = "https://script.google.com/macros/s/AKfycbzlFFMNw0Zc7IKt4Sn7KB5qggPMlh_2mdMn5uOjw93MF2L-58SPb4ZPUQKHJppLSLBi/exec"manual_content = Nonedef get_manual_content():# global manual_content# response = requests.get(manual_url)# if response.status_code == 200:manual_content = '[INST]Per il compito di matematica devi seguire il PDF su Classroom[/INST]'def format_prompt(message, history):global manual_content5 unmodified linesfor user_prompt, bot_response in history:prompt += f"[INST] {user_prompt} [/INST]"prompt += f" {bot_response}</s> "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]"return promptdef generate(24 unmodified linesreturn outputmychatbot = gr.Chatbot(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"]], )demo = gr.ChatInterface(fn=generate,chatbot=mychatbot,title="Bonsi AI 🪴",textbox=gr.Textbox(placeholder="Cosa posso fare per te, studente..."),theme="gradio/base",submit_btn="Invia",retry_btn=None,
app.py+9-9