Spaces:
Sleeping
Sleeping
Saravanan666
commited on
Update TextGen/router.py
Browse files- TextGen/router.py +8 -7
TextGen/router.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
from pydantic import BaseModel
|
2 |
|
3 |
-
from .ConfigEnv import config
|
4 |
from fastapi.middleware.cors import CORSMiddleware
|
5 |
|
6 |
from langchain.llms import Clarifai
|
@@ -18,12 +18,13 @@ def generate_text(prompt: str):
|
|
18 |
else:
|
19 |
prompt = PromptTemplate(template=prompt, input_variables=['Prompt'])
|
20 |
|
|
|
21 |
llm = Clarifai(
|
22 |
-
pat =
|
23 |
-
user_id =
|
24 |
-
app_id =
|
25 |
-
model_id =
|
26 |
-
model_version_id=
|
27 |
)
|
28 |
|
29 |
llmchain = LLMChain(
|
@@ -34,7 +35,7 @@ def generate_text(prompt: str):
|
|
34 |
llm_response = llmchain.run({"Prompt": prompt})
|
35 |
return Generate(text=llm_response)
|
36 |
|
37 |
-
|
38 |
|
39 |
app.add_middleware(
|
40 |
CORSMiddleware,
|
|
|
1 |
from pydantic import BaseModel
|
2 |
|
3 |
+
#from .ConfigEnv import config
|
4 |
from fastapi.middleware.cors import CORSMiddleware
|
5 |
|
6 |
from langchain.llms import Clarifai
|
|
|
18 |
else:
|
19 |
prompt = PromptTemplate(template=prompt, input_variables=['Prompt'])
|
20 |
|
21 |
+
|
22 |
llm = Clarifai(
|
23 |
+
pat = 'bcd9a6dff68646cfbe18ae4297674d26',
|
24 |
+
user_id = 'clarifai',
|
25 |
+
app_id = 'main',
|
26 |
+
model_id = 'datacomp-L14-lopq-1',
|
27 |
+
model_version_id='05cb975ed2954a11aafbbd9702b8a2bb',
|
28 |
)
|
29 |
|
30 |
llmchain = LLMChain(
|
|
|
35 |
llm_response = llmchain.run({"Prompt": prompt})
|
36 |
return Generate(text=llm_response)
|
37 |
|
38 |
+
|
39 |
|
40 |
app.add_middleware(
|
41 |
CORSMiddleware,
|