Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,5 +1,4 @@
|
|
1 |
import gradio as gr
|
2 |
-
import spaces
|
3 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
4 |
import torch
|
5 |
from threading import Thread
|
@@ -11,7 +10,6 @@ device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
|
11 |
phi4_model = AutoModelForCausalLM.from_pretrained(phi4_model_path, device_map="auto", torch_dtype="auto")
|
12 |
phi4_tokenizer = AutoTokenizer.from_pretrained(phi4_model_path)
|
13 |
|
14 |
-
@spaces.GPU(duration=60)
|
15 |
def generate_response(user_message, max_tokens, temperature, top_k, top_p, repetition_penalty, history_state):
|
16 |
if not user_message.strip():
|
17 |
return history_state, history_state
|
|
|
1 |
import gradio as gr
|
|
|
2 |
from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
|
3 |
import torch
|
4 |
from threading import Thread
|
|
|
10 |
phi4_model = AutoModelForCausalLM.from_pretrained(phi4_model_path, device_map="auto", torch_dtype="auto")
|
11 |
phi4_tokenizer = AutoTokenizer.from_pretrained(phi4_model_path)
|
12 |
|
|
|
13 |
def generate_response(user_message, max_tokens, temperature, top_k, top_p, repetition_penalty, history_state):
|
14 |
if not user_message.strip():
|
15 |
return history_state, history_state
|