Update for ZeroGPU
Browse files- app.py +2 -0
- requirements.txt +2 -1
app.py
CHANGED
@@ -2,6 +2,7 @@ from threading import Thread
|
|
2 |
from typing import Iterator
|
3 |
|
4 |
import gradio as gr
|
|
|
5 |
import torch
|
6 |
from transformers import (
|
7 |
AutoConfig,
|
@@ -49,6 +50,7 @@ if torch.cuda.is_available():
|
|
49 |
tokenizer.use_default_system_prompt = False
|
50 |
|
51 |
|
|
|
52 |
def generate(
|
53 |
message: str,
|
54 |
chat_history: list[tuple[str, str]],
|
|
|
2 |
from typing import Iterator
|
3 |
|
4 |
import gradio as gr
|
5 |
+
import spaces
|
6 |
import torch
|
7 |
from transformers import (
|
8 |
AutoConfig,
|
|
|
50 |
tokenizer.use_default_system_prompt = False
|
51 |
|
52 |
|
53 |
+
@spaces.GPU
|
54 |
def generate(
|
55 |
message: str,
|
56 |
chat_history: list[tuple[str, str]],
|
requirements.txt
CHANGED
@@ -4,5 +4,6 @@ gradio==3.47.1
|
|
4 |
protobuf==3.20.3
|
5 |
scipy==1.11.2
|
6 |
sentencepiece==0.1.99
|
7 |
-
|
|
|
8 |
transformers==4.34.0
|
|
|
4 |
protobuf==3.20.3
|
5 |
scipy==1.11.2
|
6 |
sentencepiece==0.1.99
|
7 |
+
spaces==0.16.1
|
8 |
+
torch==2.0.0
|
9 |
transformers==4.34.0
|