Spaces:
Sleeping
Sleeping
Create state.py
Browse files- utils/state.py +17 -0
utils/state.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from .load_model_from_hub import load_model
|
2 |
+
|
3 |
+
|
4 |
+
class State:
|
5 |
+
def __init__(self) -> None:
|
6 |
+
self.model = None
|
7 |
+
self.instructions = ""
|
8 |
+
self.input_text = ""
|
9 |
+
try:
|
10 |
+
self.model = load_model()
|
11 |
+
except Exception as e:
|
12 |
+
raise Exception(e)
|
13 |
+
|
14 |
+
def clear_all(self):
|
15 |
+
model = None
|
16 |
+
instructions = ""
|
17 |
+
input_text = ""
|