Spaces:
Running
Running
from typing import Optional | |
from src.pipeline import pipeline | |
def clear(): | |
return None, None, None, None, None | |
def generate_text(query_text: str, | |
model_name: Optional[str], | |
is_sustainable: Optional[bool], | |
starting_point: Optional[str], | |
max_tokens: Optional[int] = 1024, | |
temp: Optional[float] = 0.49, | |
): | |
model_params = { | |
'max_tokens': max_tokens, | |
'temperature': temp | |
} | |
pipeline_response = pipeline( | |
query=query_text, | |
model_name=model_name, | |
sustainability=is_sustainable, | |
starting_point=starting_point, | |
**model_params | |
) | |
if pipeline_response is None: | |
return "Error while generating response! Please try again." | |
return pipeline_response | |