Spaces:
Running
Running
Update app_t.py
Browse files
app_t.py
CHANGED
|
@@ -3,7 +3,7 @@ import textwrap
|
|
| 3 |
import traceback
|
| 4 |
import gradio as gr
|
| 5 |
from transformers import pipeline
|
| 6 |
-
|
| 7 |
# ---------------------------
|
| 8 |
# Configuration
|
| 9 |
# ---------------------------
|
|
@@ -101,6 +101,7 @@ chat_history_for_ui = []
|
|
| 101 |
# ---------------------------
|
| 102 |
# Model call helper
|
| 103 |
# ---------------------------
|
|
|
|
| 104 |
def call_model_get_response(model_id: str, messages: list, max_tokens: int = 700):
|
| 105 |
# Convert structured messages into plain text
|
| 106 |
conversation_text = ""
|
|
@@ -130,6 +131,7 @@ def call_model_get_response(model_id: str, messages: list, max_tokens: int = 700
|
|
| 130 |
# ---------------------------
|
| 131 |
# Chat logic
|
| 132 |
# ---------------------------
|
|
|
|
| 133 |
def chat_with_model(user_message, chat_history):
|
| 134 |
global history_messages, chat_history_for_ui, conversation_mode
|
| 135 |
|
|
|
|
| 3 |
import traceback
|
| 4 |
import gradio as gr
|
| 5 |
from transformers import pipeline
|
| 6 |
+
import spaces
|
| 7 |
# ---------------------------
|
| 8 |
# Configuration
|
| 9 |
# ---------------------------
|
|
|
|
| 101 |
# ---------------------------
|
| 102 |
# Model call helper
|
| 103 |
# ---------------------------
|
| 104 |
+
|
| 105 |
def call_model_get_response(model_id: str, messages: list, max_tokens: int = 700):
|
| 106 |
# Convert structured messages into plain text
|
| 107 |
conversation_text = ""
|
|
|
|
| 131 |
# ---------------------------
|
| 132 |
# Chat logic
|
| 133 |
# ---------------------------
|
| 134 |
+
@spaces.GPU()
|
| 135 |
def chat_with_model(user_message, chat_history):
|
| 136 |
global history_messages, chat_history_for_ui, conversation_mode
|
| 137 |
|