From 26851aaeadf9cf2fdee6bf7f1d4d1b5c70e03652 Mon Sep 17 00:00:00 2001 From: YasinOnm08 Date: Tue, 17 Sep 2024 13:48:04 +0200 Subject: [PATCH 1/2] fix windows css --- py/static/styles.css | 4 +++- py/web_flask.py | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/py/static/styles.css b/py/static/styles.css index 950c0d8..eea09ad 100644 --- a/py/static/styles.css +++ b/py/static/styles.css @@ -280,6 +280,7 @@ header a:hover { color: white; border: none; padding: 0; + margin: 5px; cursor: pointer; transition: transform 0.2s ease-in-out; } @@ -326,7 +327,8 @@ header a:hover { } .input button { - padding: 12px 20px; + padding:1em; + margin: 5px; background-color: var(--input-button-color); color: white; border: none; diff --git a/py/web_flask.py b/py/web_flask.py index 17a9400..d979d58 100755 --- a/py/web_flask.py +++ b/py/web_flask.py @@ -40,12 +40,11 @@ def index(): system += "The chat log is now finished." - ai_response = "AI: " + api.send_message(user_message, 5, system) + ai_response = "AI: " + api.send_message(user_message, 4, system) messages.append(ai_response) return render_template('index.html', messages=messages) - @APP.route('/faq') def faq(): return render_template('faq.html') From 0f3b5cb49aa3a416ad6ef13b288001f06805c262 Mon Sep 17 00:00:00 2001 From: Patrick_Pluto Date: Tue, 17 Sep 2024 13:49:52 +0200 Subject: [PATCH 2/2] New Changes. --- py/api.py | 5 +++-- py/install.sh | 4 +++- py/web_flask.py | 4 +--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/py/api.py b/py/api.py index 7582c39..5302360 100644 --- a/py/api.py +++ b/py/api.py @@ -1,9 +1,9 @@ import requests import json from gradio_client import Client -import os from mistralai import Mistral + class API: @staticmethod def process_text_mistralai(prompt, model, system): @@ -27,6 +27,7 @@ class API: ] ) return chat_response.choices[0].message.content + @staticmethod def process_text_gradio(prompt, model, system): client = Client(model) @@ -38,7 +39,7 @@ class API: top_p=0.95, api_name="/chat" ) - return result; + return result # This method processes a message via ollama @staticmethod diff --git a/py/install.sh b/py/install.sh index fbbea2b..ad4732f 100755 --- a/py/install.sh +++ b/py/install.sh @@ -1,6 +1,6 @@ #!/bin/bash -python3 -m venv venv +python -m venv venv source venv/bin/activate pip install flask pip install SpeechRecognition @@ -15,3 +15,5 @@ pip install mistralai ollama pull phi3.5 ollama pull codegemma:2b ollama pull gemma2:9b + +python web_flask.py \ No newline at end of file diff --git a/py/web_flask.py b/py/web_flask.py index 17a9400..f76eacd 100755 --- a/py/web_flask.py +++ b/py/web_flask.py @@ -1,5 +1,3 @@ -#!venv/bin/python - from flask import Flask, request, render_template from api import API from voice_recognition import Voice @@ -40,7 +38,7 @@ def index(): system += "The chat log is now finished." - ai_response = "AI: " + api.send_message(user_message, 5, system) + ai_response = "AI: " + api.send_message(user_message, 4, system) messages.append(ai_response) return render_template('index.html', messages=messages)