Spaces:
Runtime error
Runtime error
fastestest
Browse files
app.py
CHANGED
|
@@ -28,7 +28,6 @@ class StateController:
|
|
| 28 |
|
| 29 |
def diagnostic(self) -> str:
|
| 30 |
"""Execute diagnostic sequence and return the formatted status report."""
|
| 31 |
-
# Update state array for diagnostic verification
|
| 32 |
for i in range(51):
|
| 33 |
self._state[i] = i % self._batch
|
| 34 |
|
|
@@ -47,12 +46,12 @@ class StateController:
|
|
| 47 |
# Global singleton instance for resource reuse
|
| 48 |
controller = StateController()
|
| 49 |
|
| 50 |
-
SYSTEM_MSG =
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
|
| 57 |
def generate_response(message: str, history: list):
|
| 58 |
# Hardware diagnostic override
|
|
@@ -60,12 +59,12 @@ def generate_response(message: str, history: list):
|
|
| 60 |
yield controller.diagnostic()
|
| 61 |
return
|
| 62 |
|
| 63 |
-
#
|
| 64 |
-
messages =
|
| 65 |
-
|
| 66 |
-
{"role": "
|
| 67 |
-
|
| 68 |
-
|
| 69 |
|
| 70 |
try:
|
| 71 |
# Enable streaming for reduced time-to-first-token
|
|
@@ -104,5 +103,4 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="blue"), css=custom_css) as demo
|
|
| 104 |
)
|
| 105 |
|
| 106 |
if __name__ == "__main__":
|
| 107 |
-
# Launch with queue enabled for streaming support
|
| 108 |
demo.queue().launch(show_api=False)
|
|
|
|
| 28 |
|
| 29 |
def diagnostic(self) -> str:
|
| 30 |
"""Execute diagnostic sequence and return the formatted status report."""
|
|
|
|
| 31 |
for i in range(51):
|
| 32 |
self._state[i] = i % self._batch
|
| 33 |
|
|
|
|
| 46 |
# Global singleton instance for resource reuse
|
| 47 |
controller = StateController()
|
| 48 |
|
| 49 |
+
SYSTEM_MSG = {
|
| 50 |
+
"role": "system",
|
| 51 |
+
"content": ("You are a logic-focused inference engine. "
|
| 52 |
+
"Utilize strict state-hold memory and parallel integer blocks. "
|
| 53 |
+
"Provide direct, technical, and accurate responses.")
|
| 54 |
+
}
|
| 55 |
|
| 56 |
def generate_response(message: str, history: list):
|
| 57 |
# Hardware diagnostic override
|
|
|
|
| 59 |
yield controller.diagnostic()
|
| 60 |
return
|
| 61 |
|
| 62 |
+
# Build the message list using a standard loop to ensure syntax stability
|
| 63 |
+
messages = [SYSTEM_MSG]
|
| 64 |
+
for turn in history:
|
| 65 |
+
messages.append({"role": "user", "content": turn[0]})
|
| 66 |
+
messages.append({"role": "assistant", "content": turn[1]})
|
| 67 |
+
messages.append({"role": "user", "content": message})
|
| 68 |
|
| 69 |
try:
|
| 70 |
# Enable streaming for reduced time-to-first-token
|
|
|
|
| 103 |
)
|
| 104 |
|
| 105 |
if __name__ == "__main__":
|
|
|
|
| 106 |
demo.queue().launch(show_api=False)
|