Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -41,6 +41,7 @@ class InputData(BaseModel):
|
|
| 41 |
StringaSplit: str = '********'
|
| 42 |
NumeroCaratteriSplitInstruction: int = 30000
|
| 43 |
EliminaRisposteNonPertinenti: bool = False
|
|
|
|
| 44 |
|
| 45 |
class InputDataAsync(InputData):
|
| 46 |
test: str = ''
|
|
@@ -82,6 +83,9 @@ def generate_text(request: Request, input_data: InputData):
|
|
| 82 |
LoggaTesto("RISPOSTA ASINCRONA FINALE", {"response": result_data})
|
| 83 |
if input_data.EliminaRisposteNonPertinenti:
|
| 84 |
result_data = [item for item in result_data if "NOTFOUND" not in item["response"]]
|
|
|
|
|
|
|
|
|
|
| 85 |
return {"response": result_data}
|
| 86 |
|
| 87 |
def generate_input_text(input_data):
|
|
|
|
| 41 |
StringaSplit: str = '********'
|
| 42 |
NumeroCaratteriSplitInstruction: int = 30000
|
| 43 |
EliminaRisposteNonPertinenti: bool = False
|
| 44 |
+
UnificaRispostaPertinente: bool = False
|
| 45 |
|
| 46 |
class InputDataAsync(InputData):
|
| 47 |
test: str = ''
|
|
|
|
| 83 |
LoggaTesto("RISPOSTA ASINCRONA FINALE", {"response": result_data})
|
| 84 |
if input_data.EliminaRisposteNonPertinenti:
|
| 85 |
result_data = [item for item in result_data if "NOTFOUND" not in item["response"]]
|
| 86 |
+
if input_data.UnificaRispostaPertinente:
|
| 87 |
+
input_data.instruction = f'''{result_data}'''
|
| 88 |
+
result_data = asyncio.run(GeneraTestoAsync("https://matteoscript-fastapi.hf.space/Genera", input_data))
|
| 89 |
return {"response": result_data}
|
| 90 |
|
| 91 |
def generate_input_text(input_data):
|