Update app.py
Browse files
app.py
CHANGED
@@ -52,19 +52,17 @@ def load_model(model_name):
|
|
52 |
geomodel_llm = keras_nlp.models.CausalLM.from_preset(str(model_name))
|
53 |
return geomodel_llm
|
54 |
|
55 |
-
|
56 |
-
|
57 |
def model_launch(input):
|
58 |
-
return f"Model: {first_model}\n\nResponse to: {input}"
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
|
69 |
# Global variable to store loaded JSON data
|
70 |
loaded_data = {}
|
|
|
52 |
geomodel_llm = keras_nlp.models.CausalLM.from_preset(str(model_name))
|
53 |
return geomodel_llm
|
54 |
|
|
|
|
|
55 |
def model_launch(input):
|
56 |
+
#return f"Model: {first_model}\n\nResponse to: {input}"
|
57 |
+
geomodel_llm=load_model(first_model)
|
58 |
+
template = "Instruction:\n{instruction}\n\nResponse:\n{response}"
|
59 |
+
prompt = template.format(
|
60 |
+
instruction=input,
|
61 |
+
response="",
|
62 |
+
)
|
63 |
+
out = geomodel_llm.generate(prompt, max_length=1024)
|
64 |
+
ind = out.index('Response') + len('Response')+2
|
65 |
+
return out[ind:]
|
66 |
|
67 |
# Global variable to store loaded JSON data
|
68 |
loaded_data = {}
|