MatteoScript commited on
Commit
38f1a79
·
verified ·
1 Parent(s): 48711f9

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +19 -25
main.py CHANGED
@@ -36,12 +36,7 @@ class InputData(BaseModel):
36
  top_p: float = 0.95
37
  repetition_penalty: float = 1.0
38
 
39
- class InputDataAsync(BaseModel):
40
- input: str
41
- temperature: float = 0.7
42
- max_new_tokens: int = 30000
43
- top_p: float = 0.95
44
- repetition_penalty: float = 1.0
45
  NumeroGenerazioni: int = 1
46
  StringaSplit: str = '********'
47
 
@@ -58,26 +53,25 @@ def read_root(request: Request, input_data: InputData):
58
  top_p = input_data.top_p
59
  repetition_penalty = input_data.repetition_penalty
60
  history = []
61
- input_text = = f'''
62
- {{
63
- "input": {{
64
- "role": "system",
65
- "content": "{input_data.systemRole}",
66
- "style": "{input_data.systemStyle}",
67
-
 
 
 
 
68
  }},
69
- "messages": [
70
- {{
71
- "role": "instructions",
72
- "content": {input_data.instruction}
73
- }},
74
- {{
75
- "role": "user",
76
- "content": "{input_data.input}"
77
- }}
78
- ]
79
- }}
80
- '''
81
  generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)
82
  return {"response": generated_response}
83
 
 
36
  top_p: float = 0.95
37
  repetition_penalty: float = 1.0
38
 
39
+ class InputDataAsync(InputData):
 
 
 
 
 
40
  NumeroGenerazioni: int = 1
41
  StringaSplit: str = '********'
42
 
 
53
  top_p = input_data.top_p
54
  repetition_penalty = input_data.repetition_penalty
55
  history = []
56
+ input_text = f'''
57
+ {{
58
+ "input": {{
59
+ "role": "system",
60
+ "content": "{input_data.systemRole}",
61
+ "style": "{input_data.systemStyle}"
62
+ }},
63
+ "messages": [
64
+ {{
65
+ "role": "instructions",
66
+ "content": {input_data.instruction}
67
  }},
68
+ {{
69
+ "role": "user",
70
+ "content": "{input_data.input}"
71
+ }}
72
+ ]
73
+ }}
74
+ '''
 
 
 
 
 
75
  generated_response = generate(input_text, history, temperature, max_new_tokens, top_p, repetition_penalty)
76
  return {"response": generated_response}
77