rodrisouza commited on
Commit
9f44b5a
·
verified ·
1 Parent(s): bc340d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -39,6 +39,9 @@ tokenizer, model = None, None
39
  # Initialize the data list
40
  data = []
41
 
 
 
 
42
  # Load the model and tokenizer once at the beginning
43
  def load_model(model_name):
44
  global tokenizer, model, selected_model
@@ -67,7 +70,6 @@ tokenizer, model = load_model(selected_model)
67
 
68
  # Chat history and interaction count
69
  chat_history = []
70
- interaction_count = 0
71
 
72
  # Function to handle interaction with model
73
  @spaces.GPU
@@ -116,10 +118,7 @@ def interact(user_input, history):
116
 
117
  # Function to send selected story and initial message
118
  def send_selected_story(title, model_name, system_prompt):
119
- global chat_history
120
- global selected_story
121
- global data
122
- global interaction_count
123
  data = [] # Reset data for new story
124
  interaction_count = 0 # Reset interaction count
125
  tokenizer, model = load_model(model_name)
 
39
  # Initialize the data list
40
  data = []
41
 
42
+ # Initialize interaction count
43
+ interaction_count = 0
44
+
45
  # Load the model and tokenizer once at the beginning
46
  def load_model(model_name):
47
  global tokenizer, model, selected_model
 
70
 
71
  # Chat history and interaction count
72
  chat_history = []
 
73
 
74
  # Function to handle interaction with model
75
  @spaces.GPU
 
118
 
119
  # Function to send selected story and initial message
120
  def send_selected_story(title, model_name, system_prompt):
121
+ global chat_history, selected_story, data, interaction_count
 
 
 
122
  data = [] # Reset data for new story
123
  interaction_count = 0 # Reset interaction count
124
  tokenizer, model = load_model(model_name)