Spaces:
Runtime error
Runtime error
Commit
·
68e04a7
1
Parent(s):
02cb41c
Update main.py
Browse files
main.py
CHANGED
|
@@ -4,7 +4,6 @@ from pydantic import BaseModel
|
|
| 4 |
from huggingface_hub import InferenceClient
|
| 5 |
from datetime import datetime
|
| 6 |
|
| 7 |
-
|
| 8 |
app = FastAPI()
|
| 9 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 10 |
|
|
@@ -25,6 +24,11 @@ class InputData(BaseModel):
|
|
| 25 |
|
| 26 |
def format_prompt(message, history):
|
| 27 |
prompt = "<s>"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
for user_prompt, bot_response in history:
|
| 29 |
prompt += f"[INST] {user_prompt} [/INST]"
|
| 30 |
prompt += f" {bot_response}</s> "
|
|
|
|
| 4 |
from huggingface_hub import InferenceClient
|
| 5 |
from datetime import datetime
|
| 6 |
|
|
|
|
| 7 |
app = FastAPI()
|
| 8 |
client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
|
| 9 |
|
|
|
|
| 24 |
|
| 25 |
def format_prompt(message, history):
|
| 26 |
prompt = "<s>"
|
| 27 |
+
|
| 28 |
+
with open('Manuale.txt', 'r') as file:
|
| 29 |
+
manual_content = file.read()
|
| 30 |
+
prompt += f"[INST] Leggi questo manuale dopo ti farò delle domande: {manual_content} [/INST]"
|
| 31 |
+
|
| 32 |
for user_prompt, bot_response in history:
|
| 33 |
prompt += f"[INST] {user_prompt} [/INST]"
|
| 34 |
prompt += f" {bot_response}</s> "
|