Di Zhang
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import os
|
|
| 2 |
import gradio as gr
|
| 3 |
from llama_cpp import Llama
|
| 4 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 5 |
|
| 6 |
model = Llama(
|
| 7 |
model_path=hf_hub_download(
|
|
@@ -31,6 +32,7 @@ def llama_o1_template(data):
|
|
| 31 |
text = template.format(content=data)
|
| 32 |
return text
|
| 33 |
|
|
|
|
| 34 |
def generate_text(message, history, max_tokens=512, temperature=0.9, top_p=0.95):
|
| 35 |
temp = ""
|
| 36 |
input_texts = [llama_o1_template(message)]
|
|
|
|
| 2 |
import gradio as gr
|
| 3 |
from llama_cpp import Llama
|
| 4 |
from huggingface_hub import hf_hub_download
|
| 5 |
+
import spaces
|
| 6 |
|
| 7 |
model = Llama(
|
| 8 |
model_path=hf_hub_download(
|
|
|
|
| 32 |
text = template.format(content=data)
|
| 33 |
return text
|
| 34 |
|
| 35 |
+
@spaces.GPU(duration=200)
|
| 36 |
def generate_text(message, history, max_tokens=512, temperature=0.9, top_p=0.95):
|
| 37 |
temp = ""
|
| 38 |
input_texts = [llama_o1_template(message)]
|