MatteoScript commited on
Commit
d707be1
·
1 Parent(s): 002fca8

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +5 -1
main.py CHANGED
@@ -2,6 +2,8 @@ from fastapi import FastAPI, Request
2
  from fastapi.middleware.cors import CORSMiddleware # Importa il middleware CORS
3
  from pydantic import BaseModel
4
  from huggingface_hub import InferenceClient
 
 
5
 
6
  app = FastAPI()
7
  client = InferenceClient("mistralai/Mixtral-8x7B-Instruct-v0.1")
@@ -26,7 +28,9 @@ def format_prompt(message, history):
26
  for user_prompt, bot_response in history:
27
  prompt += f"[INST] {user_prompt} [/INST]"
28
  prompt += f" {bot_response}</s> "
29
- prompt += f"[INST] {message} [/INST]"
 
 
30
  return prompt
31
 
32
  @app.post("/Genera")
 
2
  from fastapi.middleware.cors import CORSMiddleware # Importa il middleware CORS
3
  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")
 
28
  for user_prompt, bot_response in history:
29
  prompt += f"[INST] {user_prompt} [/INST]"
30
  prompt += f" {bot_response}</s> "
31
+ now = datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")
32
+ prompt += f"[{now}] [INST] {message} [/INST]"
33
+
34
  return prompt
35
 
36
  @app.post("/Genera")