benhaotang
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def load_model():
|
|
26 |
model, tokenizer = load_model()
|
27 |
|
28 |
@spaces.GPU(duration=80) # Added the decorator here
|
29 |
-
def generate_response(prompt, max_length=
|
30 |
inputs = tokenizer(prompt, return_tensors="pt").to("cuda" if torch.cuda.is_available() else "cpu")
|
31 |
outputs = model.generate(**inputs, max_length=max_length)
|
32 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
26 |
model, tokenizer = load_model()
|
27 |
|
28 |
@spaces.GPU(duration=80) # Added the decorator here
|
29 |
+
def generate_response(prompt, max_length=1024):
|
30 |
inputs = tokenizer(prompt, return_tensors="pt").to("cuda" if torch.cuda.is_available() else "cpu")
|
31 |
outputs = model.generate(**inputs, max_length=max_length)
|
32 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|