Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,8 @@ free CPU tier.
|
|
| 10 |
Entry point for Hugging Face Spaces (Gradio SDK looks for app.py).
|
| 11 |
"""
|
| 12 |
|
|
|
|
|
|
|
| 13 |
import os
|
| 14 |
|
| 15 |
import gradio as gr
|
|
@@ -82,7 +84,7 @@ model = model.to(DEVICE)
|
|
| 82 |
model.eval()
|
| 83 |
print(f"Model loaded on {DEVICE}.")
|
| 84 |
|
| 85 |
-
|
| 86 |
def _generate(text: str, max_new_tokens: int = 400) -> str:
|
| 87 |
"""Run one generation with the current adapter state."""
|
| 88 |
messages = [
|
|
|
|
| 10 |
Entry point for Hugging Face Spaces (Gradio SDK looks for app.py).
|
| 11 |
"""
|
| 12 |
|
| 13 |
+
|
| 14 |
+
import spaces
|
| 15 |
import os
|
| 16 |
|
| 17 |
import gradio as gr
|
|
|
|
| 84 |
model.eval()
|
| 85 |
print(f"Model loaded on {DEVICE}.")
|
| 86 |
|
| 87 |
+
@spaces.GPU(duration=120)
|
| 88 |
def _generate(text: str, max_new_tokens: int = 400) -> str:
|
| 89 |
"""Run one generation with the current adapter state."""
|
| 90 |
messages = [
|