Spaces:
Paused
Paused
Changed LLM
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ from flask import Flask, request, jsonify
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
4 |
app = Flask(__name__)
|
5 |
-
client = InferenceClient("
|
6 |
|
7 |
DEFAULT_MAX_TOKENS = 512
|
8 |
DEFAULT_TEMPERATURE = 0.7
|
@@ -10,13 +10,15 @@ DEFAULT_TOP_P = 0.95
|
|
10 |
|
11 |
def generate_journal_suggestion(current_page):
|
12 |
suggestion_prompt = (
|
13 |
-
|
14 |
-
|
15 |
)
|
16 |
suggestion_response = ""
|
17 |
|
18 |
for message in client.chat_completion(
|
19 |
-
[
|
|
|
|
|
20 |
max_tokens=150,
|
21 |
stream=True,
|
22 |
temperature=DEFAULT_TEMPERATURE,
|
@@ -27,6 +29,7 @@ def generate_journal_suggestion(current_page):
|
|
27 |
|
28 |
return suggestion_response
|
29 |
|
|
|
30 |
@app.route("/", methods=["POST", "GET"])
|
31 |
def home():
|
32 |
return "Hi!"
|
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
4 |
app = Flask(__name__)
|
5 |
+
client = InferenceClient("meta-llama/Llama-3.1-8B-Instruct")
|
6 |
|
7 |
DEFAULT_MAX_TOKENS = 512
|
8 |
DEFAULT_TEMPERATURE = 0.7
|
|
|
10 |
|
11 |
def generate_journal_suggestion(current_page):
|
12 |
suggestion_prompt = (
|
13 |
+
f"""Pe baza înregistrării din jurnal: '{current_page}', generează o singură întrebare pe care utilizatorul ar putea să și-o pună în jurnalul său.
|
14 |
+
Întrebarea ar trebui să încurajeze reflecția personală mai profundă, explorarea sentimentelor sau clarificarea obiectivelor."""
|
15 |
)
|
16 |
suggestion_response = ""
|
17 |
|
18 |
for message in client.chat_completion(
|
19 |
+
[
|
20 |
+
{"role": "user", "content": suggestion_prompt}
|
21 |
+
],
|
22 |
max_tokens=150,
|
23 |
stream=True,
|
24 |
temperature=DEFAULT_TEMPERATURE,
|
|
|
29 |
|
30 |
return suggestion_response
|
31 |
|
32 |
+
|
33 |
@app.route("/", methods=["POST", "GET"])
|
34 |
def home():
|
35 |
return "Hi!"
|